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
This commit is contained in:
Jean-Philippe Lang
2008-08-03 09:14:43 +00:00
parent 6034067d86
commit a332e0a4fe
38 changed files with 210 additions and 21 deletions

View File

@@ -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