Mercurial > hg > soundsoftware-site
comparison app/models/message.rb @ 1517:dffacf8a6908 redmine-2.5
Update to Redmine SVN revision 13367 on 2.5-stable branch
author | Chris Cannam |
---|---|
date | Tue, 09 Sep 2014 09:29:00 +0100 |
parents | e248c7af89ec |
children |
comparison
equal
deleted
inserted
replaced
1516:b450a9d58aed | 1517:dffacf8a6908 |
---|---|
66 errors.add :base, 'Topic is locked' if root.locked? && self != root | 66 errors.add :base, 'Topic is locked' if root.locked? && self != root |
67 end | 67 end |
68 | 68 |
69 def update_messages_board | 69 def update_messages_board |
70 if board_id_changed? | 70 if board_id_changed? |
71 Message.update_all({:board_id => board_id}, ["id = ? OR parent_id = ?", root.id, root.id]) | 71 Message.where(["id = ? OR parent_id = ?", root.id, root.id]).update_all({:board_id => board_id}) |
72 Board.reset_counters!(board_id_was) | 72 Board.reset_counters!(board_id_was) |
73 Board.reset_counters!(board_id) | 73 Board.reset_counters!(board_id) |
74 end | 74 end |
75 end | 75 end |
76 | 76 |
77 def reset_counters! | 77 def reset_counters! |
78 if parent && parent.id | 78 if parent && parent.id |
79 Message.update_all({:last_reply_id => parent.children.maximum(:id)}, {:id => parent.id}) | 79 Message.where({:id => parent.id}).update_all({:last_reply_id => parent.children.maximum(:id)}) |
80 end | 80 end |
81 board.reset_counters! | 81 board.reset_counters! |
82 end | 82 end |
83 | 83 |
84 def sticky=(arg) | 84 def sticky=(arg) |