diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-08-03 09:14:43 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-08-03 09:14:43 +0000 |
commit | a332e0a4febeb36aac41f8d5762d18f4cbbf115c (patch) | |
tree | 8e0883bbdbfd7bfca332880da6f1739362b8c579 /app/models/watcher.rb | |
parent | 6034067d8623e87ef1391962b882fcc93196bf4b (diff) | |
download | redmine-a332e0a4febeb36aac41f8d5762d18f4cbbf115c.tar.gz redmine-a332e0a4febeb36aac41f8d5762d18f4cbbf115c.zip |
Adds permissions for viewing the watcher list and adding new watchers on the issue detail view (#398).
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1712 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/watcher.rb')
-rw-r--r-- | app/models/watcher.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/app/models/watcher.rb b/app/models/watcher.rb index cb6ff52ea..38110c584 100644 --- a/app/models/watcher.rb +++ b/app/models/watcher.rb @@ -19,5 +19,12 @@ class Watcher < ActiveRecord::Base belongs_to :watchable, :polymorphic => true belongs_to :user + validates_presence_of :user validates_uniqueness_of :user_id, :scope => [:watchable_type, :watchable_id] + + protected + + def validate + errors.add :user_id, :activerecord_error_invalid unless user.nil? || user.active? + end end |