Feature #13919 » 0003-Add-permission-check-before-sending-email.patch
| app/models/document.rb | ||
|---|---|---|
|
end
|
||
|
def notified_users
|
||
|
project.notified_users.reject {|user| !visible?(user)}
|
||
|
project.notified_users.select {|user| user.allowed_to_view_notify_target?(self) }
|
||
|
end
|
||
|
private
|
||
| app/models/issue.rb | ||
|---|---|---|
|
notified += project.users.preload(:preference).select(&:notify_about_high_priority_issues?) if priority.high?
|
||
|
notified.uniq!
|
||
|
# Remove users that can not view the issue
|
||
|
notified.reject! {|user| !visible?(user)}
|
||
|
notified
|
||
|
notified.select {|user| user.allowed_to_view_notify_target?(self)}
|
||
|
end
|
||
|
# Returns the email addresses that should be notified
|
||
| app/models/journal.rb | ||
|---|---|---|
|
def notified_users
|
||
|
notified = journalized.notified_users
|
||
|
if private_notes?
|
||
|
notified = notified.select {|user| user.allowed_to?(:view_private_notes, journalized.project)}
|
||
|
end
|
||
|
notified
|
||
|
notified.select{ |u| u.allowed_to_view_notify_target?(self) }
|
||
|
end
|
||
|
def recipients
|
||
| app/models/message.rb | ||
|---|---|---|
|
end
|
||
|
def notified_users
|
||
|
project.notified_users.reject {|user| !visible?(user)}
|
||
|
project.notified_users.select {|user| user.allowed_to_view_notify_target?(self) }
|
||
|
end
|
||
|
private
|
||
| app/models/news.rb | ||
|---|---|---|
|
end
|
||
|
def notified_users
|
||
|
project.users.select {|user| user.notify_about?(self) && user.allowed_to?(:view_news, project)}
|
||
|
project.users.select {|user| user.notify_about?(self) && user.allowed_to_view_notify_target?(self)}
|
||
|
end
|
||
|
def recipients
|
||
| app/models/user.rb | ||
|---|---|---|
|
project_ids.map(&:to_i)
|
||
|
end
|
||
|
# Return true if notify the mentioned user.
|
||
|
def notify_mentioned_user?(object)
|
||
|
self.active? &&
|
||
|
self.mail.present? &&
|
||
|
self.mail_notification.present? && self.mail_notification != 'none' &&
|
||
|
self.allowed_to_view_notify_target?(object)
|
||
|
end
|
||
|
# Return true if the user is allowed to view the notify target.
|
||
|
def allowed_to_view_notify_target?(object)
|
||
|
case object
|
||
|
when Journal
|
||
|
self.allowed_to_view_notify_target?(object.journalized) &&
|
||
|
(!object.private_notes? || self.allowed_to?(:view_private_notes, object.journalized.project))
|
||
|
when Comment
|
||
|
self.allowed_to_view_notify_target?(object.commented)
|
||
|
when nil
|
||
|
false
|
||
|
else
|
||
|
object.visible?(self)
|
||
|
end
|
||
|
end
|
||
|
protected
|
||
|
def validate_password_length
|
||
| lib/redmine/acts/mentionable.rb | ||
|---|---|---|
|
def notified_mentions
|
||
|
notified = mentioned_users.to_a
|
||
|
notified.reject! {|user| user.mail.blank? || user.mail_notification == 'none'}
|
||
|
notified
|
||
|
notified.select{|user| user.notify_mentioned_user?(self) }
|
||
|
end
|
||
|
private
|
||