Add setting edit_history_visible_to_public to control whether post edits can be viewed by everyone. Uncheck it so only staff users can see edits.

This commit is contained in:
Neil Lalonde 2013-08-12 11:12:12 -04:00
parent f99bc4c43a
commit 879652f055
5 changed files with 19 additions and 6 deletions

View File

@ -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()
});

View File

@ -32,10 +32,17 @@
<div class='topic-meta-data-inside'>
{{#if hasHistory}}
<div class='post-info edits'>
<a href='#' class="{{unbound historyHeat}}" {{action showHistory this}} title="{{i18n post.last_edited_on}} {{unboundDate updated_at}}">
{{editCount}}
<i class='icon-pencil'></i>
</a>
{{#if canViewEditHistory}}
<a href='#' class="{{unbound historyHeat}}" {{action showHistory this}} title="{{i18n post.last_edited_on}} {{unboundDate updated_at}}">
{{editCount}}
<i class='icon-pencil'></i>
</a>
{{else}}
<span class="{{unbound historyHeat}}" title="{{i18n post.last_edited_on}} {{unboundDate updated_at}}">
{{editCount}}
<i class='icon-pencil'></i>
</span>
{{/if}}
</div>
{{/if}}
<div class='post-info'>

View File

@ -390,7 +390,7 @@
display: inline-block;
margin-right: 12px;
&.edits {
a, a:visited {
a, a:visited, span {
color: #aaa;
}
}

View File

@ -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, '')

View File

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