From c23a4fcbee49d0f0fbb9bd1329371cf3d761dbb6 Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 24 Jun 2014 13:20:57 +1000 Subject: [PATCH] FEATURE: flag resolution in admin screen --- .../javascripts/admin/models/flagged_post.js | 11 ++++++++- .../admin/templates/flags.js.handlebars | 24 +++++++++++++++++++ config/locales/client.en.yml | 1 + lib/flag_query.rb | 1 + 4 files changed, 36 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/admin/models/flagged_post.js b/app/assets/javascripts/admin/models/flagged_post.js index c56e132189d..8e424baf1c4 100644 --- a/app/assets/javascripts/admin/models/flagged_post.js +++ b/app/assets/javascripts/admin/models/flagged_post.js @@ -23,8 +23,17 @@ Discourse.FlaggedPost = Discourse.Post.extend({ r = []; _.each(this.post_actions, function(action) { var user = _this.userLookup[action.user_id]; + var deletedBy = null; + if(action.deleted_by_id){ + deletedBy = _this.userLookup[action.deleted_by_id]; + } + var flagType = I18n.t('admin.flags.summary.action_type_' + action.post_action_type_id, {count: 1}); - r.push({user: user, flagType: flagType, flaggedAt: action.created_at}); + + r.push({ + user: user, flagType: flagType, flaggedAt: action.created_at, deletedBy: deletedBy, + tookAction: action.staff_took_action, deletedAt: action.deleted_at + }); }); return r; }.property(), diff --git a/app/assets/javascripts/admin/templates/flags.js.handlebars b/app/assets/javascripts/admin/templates/flags.js.handlebars index b56ae6283b5..5329ec63ebc 100644 --- a/app/assets/javascripts/admin/templates/flags.js.handlebars +++ b/app/assets/javascripts/admin/templates/flags.js.handlebars @@ -18,6 +18,7 @@ {{i18n admin.flags.flagged_by}} + {{#if adminOldFlagsView}}{{i18n admin.flags.resolved_by}}{{/if}} @@ -62,6 +63,29 @@ + + + + {{#each flaggedPost.flaggers}} + + {{#if deletedBy}} + + + + {{/if}} + + {{/each}} + +
+ {{#link-to 'adminUser' this.deletedBy}}{{avatar this.deletedBy imageSize="small"}} {{/link-to}} + + {{#if this.tookAction}} + + {{/if}} + + {{date this.deletedAt}} +
+ {{#if flaggedPost.topicFlagged}} diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 76693c3c9ff..f52ac6d7698 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -1387,6 +1387,7 @@ en: clear_topic_flags_title: "The topic has been investigated and issues have been resolved. Click Done to remove the flags." flagged_by: "Flagged by" + resolved_by: "Resolved by" system: "System" error: "Something went wrong" view_message: "Reply" diff --git a/lib/flag_query.rb b/lib/flag_query.rb index 2a5488d4d5d..41324f9bab0 100644 --- a/lib/flag_query.rb +++ b/lib/flag_query.rb @@ -57,6 +57,7 @@ module FlagQuery end post.post_actions << action users << pa.user_id + users << pa.deleted_by_id if pa.deleted_by_id end # TODO add serializer so we can skip this