FEATURE: new "disable_edit_notifications" site setting

Should be used whenever you activate the "download_remote_images_to_local" site setting to prevent users from receiving a lot of edit notifications from the system user.
This commit is contained in:
Régis Hanol 2014-06-11 17:14:00 +02:00
parent f822491886
commit ce732d2252
4 changed files with 13 additions and 0 deletions

View file

@ -41,6 +41,7 @@ class PostAlertObserver < ActiveRecord::Observer
post = post_revision.post post = post_revision.post
return unless post return unless post
return if SiteSetting.disable_edit_notifications
return if post_revision.user.blank? return if post_revision.user.blank?
return if post_revision.user_id == post.user_id return if post_revision.user_id == post.user_id
return if post.topic.private_message? return if post.topic.private_message?

View file

@ -889,6 +889,8 @@ en:
global_notice: "Display an URGENT, EMERGENCY global banner notice to all visitors, change to blank to hide it (HTML allowed)." global_notice: "Display an URGENT, EMERGENCY global banner notice to all visitors, change to blank to hide it (HTML allowed)."
disable_edit_notifications: "Used to disable edit notifications when you activate the 'download_remote_images_to_local' site setting."
enable_names: "Allow users to show their full names" enable_names: "Allow users to show their full names"
display_name_on_posts: "Also show a user's full name on their posts" display_name_on_posts: "Also show a user's full name on their posts"
invites_shown: "Maximum invites shown on a user page" invites_shown: "Maximum invites shown on a user page"

View file

@ -598,3 +598,5 @@ uncategorized:
enable_system_avatars: enable_system_avatars:
hidden: true hidden: true
default: true default: true
disable_edit_notifications: false

View file

@ -38,6 +38,14 @@ describe PostAlertObserver do
post.revise(evil_trout, "world is the new body of the message") post.revise(evil_trout, "world is the new body of the message")
}.should change(post.user.notifications, :count).by(1) }.should change(post.user.notifications, :count).by(1)
end end
it 'does not notifiy a user of the revision when edit notifications are disabled' do
SiteSetting.stubs(:disable_edit_notifications).returns(true)
lambda {
post.revise(evil_trout, "world is the new body of the message")
}.should_not change(post.user.notifications, :count).by(1)
end
end end
context 'private message' do context 'private message' do