diff options
Diffstat (limited to 'app/models/message.rb')
-rw-r--r-- | app/models/message.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/models/message.rb b/app/models/message.rb index 80df7a33a..f1cb2d0ba 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -33,11 +33,14 @@ class Message < ActiveRecord::Base {:id => o.parent_id, :anchor => "message-#{o.id}"})} acts_as_activity_provider :find_options => {:include => [{:board => :project}, :author]} + acts_as_watchable attr_protected :locked, :sticky validates_presence_of :subject, :content validates_length_of :subject, :maximum => 255 + after_create :add_author_as_watcher + def validate_on_create # Can not reply to a locked topic errors.add_to_base 'Topic is locked' if root.locked? && self != root @@ -68,4 +71,10 @@ class Message < ActiveRecord::Base def project board.project end + + private + + def add_author_as_watcher + Watcher.create(:watchable => self.root, :user => author) + end end |