diff --git a/app/assets/javascripts/discourse/models/post.js b/app/assets/javascripts/discourse/models/post.js index 0fe6af36974..d6801a18e3d 100644 --- a/app/assets/javascripts/discourse/models/post.js +++ b/app/assets/javascripts/discourse/models/post.js @@ -343,7 +343,11 @@ Discourse.Post = Discourse.Model.extend({ topic = this.get('topic'); return !topic.isReplyDirectlyBelow(this); - }.property('reply_count') + }.property('reply_count'), + + canViewEditHistory: function() { + return (Discourse.SiteSettings.edit_history_visible_to_public || (Discourse.User.current() && Discourse.User.current().get('staff'))); + }.property() }); diff --git a/app/assets/javascripts/discourse/templates/post.js.handlebars b/app/assets/javascripts/discourse/templates/post.js.handlebars index efb2f3a08ca..23924a53517 100644 --- a/app/assets/javascripts/discourse/templates/post.js.handlebars +++ b/app/assets/javascripts/discourse/templates/post.js.handlebars @@ -32,10 +32,17 @@
{{#if hasHistory}}
- - {{editCount}} - - + {{#if canViewEditHistory}} + + {{editCount}} + + + {{else}} + + {{editCount}} + + + {{/if}}
{{/if}}
diff --git a/app/assets/stylesheets/application/topic-post.css.scss b/app/assets/stylesheets/application/topic-post.css.scss index 59b51d893c9..fac9e99bbbf 100644 --- a/app/assets/stylesheets/application/topic-post.css.scss +++ b/app/assets/stylesheets/application/topic-post.css.scss @@ -390,7 +390,7 @@ display: inline-block; margin-right: 12px; &.edits { - a, a:visited { + a, a:visited, span { color: #aaa; } } diff --git a/app/models/site_setting.rb b/app/models/site_setting.rb index 8f226d1ad4f..e65468c80c9 100644 --- a/app/models/site_setting.rb +++ b/app/models/site_setting.rb @@ -87,6 +87,7 @@ class SiteSetting < ActiveRecord::Base setting(:apple_touch_icon_url, '/assets/default-apple-touch-icon.png') setting(:ninja_edit_window, 5.minutes.to_i) + client_setting(:edit_history_visible_to_public, true) client_setting(:delete_removed_posts_after, 24) # hours setting(:post_undo_action_window_mins, 10) setting(:system_username, '') diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index b901cd19b31..2be8896bca0 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -468,6 +468,7 @@ en: queue_jobs: "DEVELOPER ONLY! WARNING! By default, queue jobs in sidekiq. If disabled, your site will be broken." crawl_images: "Enable retrieving images from third party sources to insert width and height dimensions" ninja_edit_window: "Number of seconds after posting where edits do not create a new version" + edit_history_visible_to_public: "Allow everyone to see past versions of an edited post. If disabled, staff members are the only ones able to view edit history." delete_removed_posts_after: "Number of hours after which a post that was removed by its author will be deleted." max_image_width: "Maximum allowed width of images in a post" category_featured_topics: "Number of topics displayed per category in the /categories page"