diff --git a/app/assets/javascripts/discourse/templates/user/preferences.js.handlebars b/app/assets/javascripts/discourse/templates/user/preferences.js.handlebars index 1d683ba80e4..ca7a8213f55 100644 --- a/app/assets/javascripts/discourse/templates/user/preferences.js.handlebars +++ b/app/assets/javascripts/discourse/templates/user/preferences.js.handlebars @@ -167,6 +167,9 @@ {{preference-checkbox labelKey="user.enable_quoting" checked=enable_quoting}} {{preference-checkbox labelKey="user.dynamic_favicon" checked=dynamic_favicon}} {{preference-checkbox labelKey="user.disable_jump_reply" checked=disable_jump_reply}} + {{#if !Discourse.SiteSettings.edit_history_available_to_public}} + {{preference-checkbox labelKey="user.edit_history_public" checked=edit_history_public}} + {{/if}} {{plugin-outlet "user_custom_preferences"}} diff --git a/app/models/user.rb b/app/models/user.rb index 6762bcfdf2b..7f8596c8854 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -774,6 +774,7 @@ end # registration_ip_address :inet # last_redirected_to_top_at :datetime # disable_jump_reply :boolean default(FALSE), not null +# edit_history_public :boolean default(FALSE), not null # # Indexes # diff --git a/app/serializers/user_serializer.rb b/app/serializers/user_serializer.rb index 3968dc2b717..43237b55a3e 100644 --- a/app/serializers/user_serializer.rb +++ b/app/serializers/user_serializer.rb @@ -77,7 +77,8 @@ class UserSerializer < BasicUserSerializer :gravatar_avatar_upload_id, :custom_avatar_upload_id, :custom_fields, - :has_title_badges + :has_title_badges, + :edit_history_public ### ### ATTRIBUTES diff --git a/app/services/user_updater.rb b/app/services/user_updater.rb index f1f7a24412e..dce86dccf24 100644 --- a/app/services/user_updater.rb +++ b/app/services/user_updater.rb @@ -15,7 +15,8 @@ class UserUpdater :enable_quoting, :dynamic_favicon, :mailing_list_mode, - :disable_jump_reply + :disable_jump_reply, + :edit_history_public ] PROFILE_ATTR = [ diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 4f90e8ae502..5e50e1985f1 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -271,6 +271,7 @@ en: notifications: "Notifications" disable_jump_reply: "Don't jump to your new post after replying" dynamic_favicon: "Show incoming message notifications on favicon (experimental)" + edit_history_public: "Let other users view my post revisions" external_links_in_new_tab: "Open all external links in a new tab" enable_quoting: "Enable quote reply for highlighted text" change: "change" diff --git a/db/migrate/20140727030954_add_edit_history_public_to_users.rb b/db/migrate/20140727030954_add_edit_history_public_to_users.rb new file mode 100644 index 00000000000..61d571aeb79 --- /dev/null +++ b/db/migrate/20140727030954_add_edit_history_public_to_users.rb @@ -0,0 +1,5 @@ +class AddEditHistoryPublicToUsers < ActiveRecord::Migration + def change + add_column :users, :edit_history_public, :boolean, default: false, null: false + end +end diff --git a/lib/guardian/post_guardian.rb b/lib/guardian/post_guardian.rb index 17dcaf83d8e..244afbd58c8 100644 --- a/lib/guardian/post_guardian.rb +++ b/lib/guardian/post_guardian.rb @@ -137,7 +137,7 @@ module PostGuardian return false unless post if !post.hidden - return true if post.wiki || SiteSetting.edit_history_visible_to_public + return true if post.wiki || SiteSetting.edit_history_visible_to_public || post.user.edit_history_public end authenticated? &&