FEATURE: Hide ignored user's Original Post content (#7113)

* FEATURE: Hide ignored user's Original Post content
This commit is contained in:
Tarek Khalil 2019-03-06 09:20:45 +00:00 committed by GitHub
parent 05ebb52ec4
commit b58eea1fcb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 1 deletions

View File

@ -80,6 +80,7 @@ export function transformBasicPost(post) {
expandablePost: false,
replyCount: post.reply_count,
locked: post.locked,
ignored: post.ignored,
userCustomFields: post.user_custom_fields
};

View File

@ -608,6 +608,9 @@ export default createWidget("post", {
} else {
classNames.push("regular");
}
if (attrs.ignored) {
classNames.push("post-ignored");
}
if (addPostClassesCallbacks) {
for (let i = 0; i < addPostClassesCallbacks.length; i++) {
let pluginClasses = addPostClassesCallbacks[i].call(this, attrs);

View File

@ -214,6 +214,10 @@ aside.quote {
margin: -2px;
}
.post-ignored {
font-style: italic;
}
.post-action {
.undo-action,
.act-action {

View File

@ -6,7 +6,8 @@ class BasicPostSerializer < ApplicationSerializer
:avatar_template,
:created_at,
:cooked,
:cooked_hidden
:cooked_hidden,
:ignored
def name
object.user && object.user.name
@ -35,11 +36,18 @@ class BasicPostSerializer < ApplicationSerializer
else
I18n.t('flagging.user_must_edit')
end
elsif ignored
I18n.t('ignored.hidden_content')
else
object.filter_quotes(@parent_post)
end
end
def ignored
object.is_first_post? && IgnoredUser.where(user_id: scope.current_user&.id,
ignored_user_id: object.user_id).present?
end
def include_name?
SiteSetting.enable_names?
end

View File

@ -870,6 +870,9 @@ en:
you_must_edit: '<p>Your post was flagged by the community. Please <a href="%{path}">see your messages</a>.</p>'
user_must_edit: "<p>This post was flagged by the community and is temporarily hidden.</p>"
ignored:
hidden_content: '<p>Hidden content</p>'
archetypes:
regular:
title: "Regular Topic"