|
|
|
@ -31,8 +31,7 @@ class WikiContentObserver < ActiveRecord::Observer |
|
|
|
|
def after_create(wiki_content) |
|
|
|
|
if Setting.notified_events.include?('wiki_content_added') |
|
|
|
|
recipients = wiki_content.recipients + wiki_content.page.wiki.watcher_recipients |
|
|
|
|
users = User.find_all_by_mails(recipients.uniq) |
|
|
|
|
users.each do |user| |
|
|
|
|
recipients.uniq.each do |user| |
|
|
|
|
UserMailer.wiki_content_added(user, wiki_content, User.current).deliver |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
@ -40,9 +39,10 @@ class WikiContentObserver < ActiveRecord::Observer |
|
|
|
|
|
|
|
|
|
def after_update(wiki_content) |
|
|
|
|
if wiki_content.text_changed? && Setting.notified_events.include?('wiki_content_updated') |
|
|
|
|
recipients = wiki_content.recipients + wiki_content.page.wiki.watcher_recipients + wiki_content.page.watcher_recipients |
|
|
|
|
users = User.find_all_by_mails(recipients.uniq) |
|
|
|
|
users.each do |user| |
|
|
|
|
recipients = wiki_content.recipients |
|
|
|
|
recipients += wiki_content.page.wiki.watcher_recipients |
|
|
|
|
recipients += wiki_content.page.watcher_recipients |
|
|
|
|
recipients.uniq.each do |user| |
|
|
|
|
UserMailer.wiki_content_updated(user, wiki_content, User.current).deliver |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|