Make sure users don't get notified for thing they can not view (#3589).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3169 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2009-12-13 14:26:54 +00:00
parent 6610bb6b6c
commit bb477a3a0f
7 changed files with 97 additions and 22 deletions
+11
View File
@@ -25,11 +25,22 @@ class WikiContent < ActiveRecord::Base
validates_length_of :comments, :maximum => 255, :allow_nil => true
acts_as_versioned
def visible?(user=User.current)
page.visible?(user)
end
def project
page.project
end
# Returns the mail adresses of users that should be notified
def recipients
notified = project.notified_users
notified.reject! {|user| !visible?(user)}
notified.collect(&:mail)
end
class Version
belongs_to :page, :class_name => '::WikiPage', :foreign_key => 'page_id'
belongs_to :author, :class_name => '::User', :foreign_key => 'author_id'