When system flags users as sockpuppets, show a reason in the admin flags ui

This commit is contained in:
Neil Lalonde 2013-10-16 11:47:01 -04:00
parent debd9bfb25
commit c7aaee907b
4 changed files with 14 additions and 4 deletions

View File

@ -38,7 +38,8 @@ Discourse.FlaggedPost = Discourse.Post.extend({
r.push({
user: _this.userLookup[action.user_id],
message: action.message,
permalink: action.permalink
permalink: action.permalink,
bySystemUser: (action.user_id === -1 ? true : false)
});
}
});

View File

@ -54,7 +54,13 @@
<tr>
<td></td>
<td class='message'>
<div>{{#link-to 'adminUser' user}}{{avatar user imageSize="small"}}{{/link-to}} {{message}} <a href="{{unbound permalink}}"><button class='btn'><i class="icon-reply"></i> {{i18n admin.flags.view_message}}</button></a></div>
<div>
{{#link-to 'adminUser' user}}{{avatar user imageSize="small"}}{{/link-to}}
{{message}}
{{#unless bySystemUser}}
<a href="{{unbound permalink}}"><button class='btn'><i class="icon-reply"></i> {{i18n admin.flags.view_message}}</button></a>
{{/unless}}
</div>
</td>
<td></td>
<td></td>

View File

@ -40,9 +40,9 @@ class SpamRulesEnforcer
def flag_sockpuppet_users
system_user = Discourse.system_user
PostAction.act(system_user, @post, PostActionType.types[:spam]) rescue PostAction::AlreadyActed
PostAction.act(system_user, @post, PostActionType.types[:spam], message: I18n.t('flag_reason.sockpuppet')) rescue PostAction::AlreadyActed
if (first_post = @post.topic.posts.by_post_number.first).try(:user).try(:new_user?)
PostAction.act(system_user, first_post, PostActionType.types[:spam]) rescue PostAction::AlreadyActed
PostAction.act(system_user, first_post, PostActionType.types[:spam], message: I18n.t('flag_reason.sockpuppet')) rescue PostAction::AlreadyActed
end
end

View File

@ -1159,3 +1159,6 @@ en:
fetch_failure: "Sorry, there has been an error while fetching the image."
unknown_image_type: "Sorry, but the file you tried to upload doesn't appear to be an image."
size_not_found: "Sorry, but we couldn't determine the size of the image. Maybe your image is corrupted?"
flag_reason:
sockpuppet: "A new user created a topic, and another new user at the same IP address replied. See the flag_sockpuppets site setting."