mirror of
https://github.com/redmine/redmine.git
synced 2024-08-27 17:54:48 +02:00
![Jean-Philippe Lang](/assets/img/avatar_default.png)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2415 e93f8b46-1217-0410-a6f0-8f06a7374b81
16 lines
749 B
Ruby
16 lines
749 B
Ruby
class SetTopicAuthorsAsWatchers < ActiveRecord::Migration
|
|
def self.up
|
|
# Sets active users who created/replied a topic as watchers of the topic
|
|
# so that the new watch functionality at topic level doesn't affect notifications behaviour
|
|
Message.connection.execute("INSERT INTO #{Watcher.table_name} (watchable_type, watchable_id, user_id)" +
|
|
" SELECT DISTINCT 'Message', COALESCE(m.parent_id, m.id), m.author_id" +
|
|
" FROM #{Message.table_name} m, #{User.table_name} u" +
|
|
" WHERE m.author_id = u.id AND u.status = 1")
|
|
end
|
|
|
|
def self.down
|
|
# Removes all message watchers
|
|
Watcher.delete_all("watchable_type = 'Message'")
|
|
end
|
|
end
|