annotate .svn/pristine/8c/8c1df4d73d6e3117c24c3c76b9007e79ab4c6eb2.svn-base @ 1298:4f746d8966dd
redmine_2.3_integration
Merge from redmine-2.3 branch to create new branch redmine-2.3-integration
author |
Chris Cannam |
date |
Fri, 14 Jun 2013 09:28:30 +0100 |
parents |
cbb26bc654de |
children |
|
rev |
line source |
Chris@909
|
1 class SetTopicAuthorsAsWatchers < ActiveRecord::Migration
|
Chris@909
|
2 def self.up
|
Chris@909
|
3 # Sets active users who created/replied a topic as watchers of the topic
|
Chris@909
|
4 # so that the new watch functionality at topic level doesn't affect notifications behaviour
|
Chris@909
|
5 Message.connection.execute("INSERT INTO #{Watcher.table_name} (watchable_type, watchable_id, user_id)" +
|
Chris@909
|
6 " SELECT DISTINCT 'Message', COALESCE(m.parent_id, m.id), m.author_id" +
|
Chris@909
|
7 " FROM #{Message.table_name} m, #{User.table_name} u" +
|
Chris@909
|
8 " WHERE m.author_id = u.id AND u.status = 1")
|
Chris@909
|
9 end
|
Chris@909
|
10
|
Chris@909
|
11 def self.down
|
Chris@909
|
12 # Removes all message watchers
|
Chris@909
|
13 Watcher.delete_all("watchable_type = 'Message'")
|
Chris@909
|
14 end
|
Chris@909
|
15 end
|