add profile option for edit history, visible only when edit history is disabled globally.

This commit is contained in:
Ben Lubar 2014-07-26 23:04:46 -05:00
parent 782773f774
commit 44dc4b4a17
7 changed files with 15 additions and 3 deletions

View File

@ -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"}}
</div>

View File

@ -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
#

View File

@ -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

View File

@ -15,7 +15,8 @@ class UserUpdater
:enable_quoting,
:dynamic_favicon,
:mailing_list_mode,
:disable_jump_reply
:disable_jump_reply,
:edit_history_public
]
PROFILE_ATTR = [

View File

@ -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"

View File

@ -0,0 +1,5 @@
class AddEditHistoryPublicToUsers < ActiveRecord::Migration
def change
add_column :users, :edit_history_public, :boolean, default: false, null: false
end
end

View File

@ -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? &&