Makes user unwatch what he can no longer view after its permissions have changed (#3589).

A rake task (redmine:watchers:prune) is also added to prune existing watchers.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3167 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang committed 2009-12-13 12:39:22 +00:00
1 parent c31a671973
commit f33231181f
12 files changed
+203 -6

No files matched your search

+4
View File
@@ -42,6 +42,10 @@ class Message < ActiveRecord::Base
after_create :add_author_as_watcher
def visible?(user=User.current)
!user.nil? && user.allowed_to?(:view_messages, project)
end
def validate_on_create
# Can not reply to a locked topic
errors.add_to_base 'Topic is locked' if root.locked? && self != root