diff --git a/app/models/post_alert_observer.rb b/app/models/post_alert_observer.rb index fcefb7021..61bf57e6d 100644 --- a/app/models/post_alert_observer.rb +++ b/app/models/post_alert_observer.rb @@ -41,6 +41,7 @@ class PostAlertObserver < ActiveRecord::Observer post = post_revision.post return unless post + return if SiteSetting.disable_edit_notifications return if post_revision.user.blank? return if post_revision.user_id == post.user_id return if post.topic.private_message? diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 94f625086..faa880d16 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -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)." + 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" display_name_on_posts: "Also show a user's full name on their posts" invites_shown: "Maximum invites shown on a user page" diff --git a/config/site_settings.yml b/config/site_settings.yml index c96b3b093..84145cfe5 100644 --- a/config/site_settings.yml +++ b/config/site_settings.yml @@ -598,3 +598,5 @@ uncategorized: enable_system_avatars: hidden: true default: true + + disable_edit_notifications: false diff --git a/spec/models/post_alert_observer_spec.rb b/spec/models/post_alert_observer_spec.rb index c243f2cb1..8e16f6cbe 100644 --- a/spec/models/post_alert_observer_spec.rb +++ b/spec/models/post_alert_observer_spec.rb @@ -38,6 +38,14 @@ describe PostAlertObserver do post.revise(evil_trout, "world is the new body of the message") }.should change(post.user.notifications, :count).by(1) 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 context 'private message' do