diff --git a/app/assets/javascripts/admin/components/flagged-post.js.es6 b/app/assets/javascripts/admin/components/flagged-post.js.es6 index 4623c17e59c..e1cbed8fc8a 100644 --- a/app/assets/javascripts/admin/components/flagged-post.js.es6 +++ b/app/assets/javascripts/admin/components/flagged-post.js.es6 @@ -1,6 +1,8 @@ import showModal from 'discourse/lib/show-modal'; export default Ember.Component.extend({ + expanded: false, + tagName: 'div', classNameBindings: [ ':flagged-post', @@ -36,6 +38,12 @@ export default Ember.Component.extend({ defer() { this.removeAfter(this.get('flaggedPost').deferFlags()); + }, + + expand() { + this.get('flaggedPost').expandHidden().then(() => { + this.set('expanded', true); + }); } } }); diff --git a/app/assets/javascripts/admin/models/flagged-post.js.es6 b/app/assets/javascripts/admin/models/flagged-post.js.es6 index 73e513f12c4..9dee23c2615 100644 --- a/app/assets/javascripts/admin/models/flagged-post.js.es6 +++ b/app/assets/javascripts/admin/models/flagged-post.js.es6 @@ -66,4 +66,5 @@ export default Post.extend({ postHidden: Ember.computed.alias('hidden'), deleted: Ember.computed.or('deleted_at', 'topic_deleted_at'), + }); diff --git a/app/assets/javascripts/admin/templates/components/flag-user.hbs b/app/assets/javascripts/admin/templates/components/flag-user.hbs new file mode 100644 index 00000000000..92f6871847f --- /dev/null +++ b/app/assets/javascripts/admin/templates/components/flag-user.hbs @@ -0,0 +1,18 @@ +
+ {{#link-to 'adminUser' user.id user.username class='flag-user-avatar'}} + {{avatar user imageSize="small"}} + {{/link-to}} +
+
+ {{#link-to 'adminUser' user.id user.username class="flag-user-username"}} + {{user.username}} + {{/link-to}} +
+ {{format-age date}} +
+
+
+ {{yield}} +
+
+
diff --git a/app/assets/javascripts/admin/templates/components/flagged-post-response.hbs b/app/assets/javascripts/admin/templates/components/flagged-post-response.hbs index be71bef0793..133c72b036e 100644 --- a/app/assets/javascripts/admin/templates/components/flagged-post-response.hbs +++ b/app/assets/javascripts/admin/templates/components/flagged-post-response.hbs @@ -1,5 +1,5 @@ {{#link-to 'adminUser' response.user.id response.user.username class="response-avatar"}} - {{avatar response.user imageSize="medium"}} + {{avatar response.user imageSize="small"}} {{/link-to}}
{{{response.excerpt}}}
{{#if hasMore}} diff --git a/app/assets/javascripts/admin/templates/components/flagged-post.hbs b/app/assets/javascripts/admin/templates/components/flagged-post.hbs index 38cc482f1da..7d04159a816 100644 --- a/app/assets/javascripts/admin/templates/components/flagged-post.hbs +++ b/app/assets/javascripts/admin/templates/components/flagged-post.hbs @@ -17,134 +17,126 @@ {{/if}} -
- {{#unless hideTitle}} -

- {{#if flaggedPost.topic.isPrivateMessage}} - {{d-icon "envelope"}} +
+
+ {{#unless hideTitle}} +

+ {{#if flaggedPost.topic.isPrivateMessage}} + {{d-icon "envelope"}} + {{/if}} + {{topic-status topic=flaggedPost.topic}} + {{{unbound flaggedPost.topic.fancyTitle}}} +

+ {{/unless}} + {{#if flaggedPost.postAuthorFlagged}} + {{#if expanded}} + {{{flaggedPost.cooked}}} + {{else}} +

+ {{{flaggedPost.excerpt}}} + {{i18n "admin.flags.show_full"}} +

{{/if}} - {{topic-status topic=flaggedPost.topic}} - {{{unbound flaggedPost.topic.fancyTitle}}} -

- {{/unless}} - {{#if flaggedPost.postAuthorFlagged}} -

{{{flaggedPost.excerpt}}}

- {{/if}} -
+ {{/if}} + -
- {{#if site.mobileView}} -
- {{i18n 'admin.flags.flagged_by'}} + {{#if flaggedPost.topicFlagged}} +
+ {{{i18n 'admin.flags.topic_flagged'}}} + {{i18n 'admin.flags.visit_topic'}}
{{/if}} - {{#each flaggedPost.post_actions as |postAction|}} -
- {{#link-to 'adminUser' postAction.user.id postAction.user.username class='flagger-avatar'}} - {{avatar postAction.user imageSize="medium"}} - {{/link-to}} -
-
- {{#link-to 'adminUser' postAction.user.id postAction.user.username}} - {{postAction.user.username}} - {{/link-to}} -
-
- {{format-age postAction.created_at}} -
-
- {{i18n (concat "admin.flags.summary.action_type_" postAction.post_action_type_id) count=1}} -
-
+ {{#each flaggedPost.conversations as |c|}} +
+ {{#if c.response}} + {{flagged-post-response response=c.response}} + {{#if c.reply}} + {{flagged-post-response response=c.reply hasMore=c.hasMore permalink=c.permalink}} + {{/if}} + + {{d-icon "reply"}} + {{i18n "admin.flags.reply_message"}} + + {{/if}}
{{/each}} -
- {{#if showResolvedBy}} -
- {{#each flaggedPost.post_actions as |postAction|}} -
- {{#link-to - 'adminUser' - postAction.disposed_by.id - postAction.disposed_by.username - class="disposer-avatar"}} - {{avatar postAction.disposed_by imageSize="medium"}} - {{/link-to}} -
- {{format-age postAction.disposed_at}} - {{disposition-icon postAction.disposition}} - {{#if postAction.staff_took_action}} - {{d-icon "gavel" title="admin.flags.took_action"}} - {{/if}} +
+
+
+ {{i18n "admin.flags.flagged_by"}} +
+
+ {{#each flaggedPost.post_actions as |postAction|}} + {{#flag-user user=postAction.user date=postAction.created_at}} +
+ {{i18n (concat "admin.flags.summary.action_type_" postAction.post_action_type_id) count=1}} +
+ {{/flag-user}} + {{/each}} +
+
+ + {{#if showResolvedBy}} +
+
+ {{i18n "admin.flags.resolved_by"}} +
+
+ {{#each flaggedPost.post_actions as |postAction|}} + {{#flag-user user=postAction.disposed_by date=postAction.disposed_at}} + {{disposition-icon postAction.disposition}} + {{#if postAction.staff_took_action}} + {{d-icon "gavel" title="admin.flags.took_action"}} + {{/if}} + {{/flag-user}} + {{/each}}
- {{/each}} -
- {{/if}} -
- -{{#if flaggedPost.topicFlagged}} -
- {{{i18n 'admin.flags.topic_flagged'}}} - {{i18n 'admin.flags.visit_topic'}} -
-{{/if}} - -{{#each flaggedPost.conversations as |c|}} -
- {{#if c.response}} - {{flagged-post-response response=c.response}} - {{#if c.reply}} - {{flagged-post-response response=c.reply hasMore=c.hasMore permalink=c.permalink}} {{/if}} - - {{d-icon "reply"}} - {{i18n "admin.flags.reply_message"}} - +
+ + {{#if canAct}} +
+ {{d-button + title="admin.flags.agree_title" + class="agree-flag" + label="admin.flags.agree" + icon="thumbs-o-up" + action="showAgreeFlagModal" + ellipsis=true}} + + {{#if flaggedPost.postHidden}} + {{d-button + title="admin.flags.disagree_flag_unhide_post_title" + class="disagree-flag" + action="disagree" + icon="thumbs-o-down" + label="admin.flags.disagree_flag_unhide_post"}} + {{else}} + {{d-button + title="admin.flags.disagree_flag_title" + class="disagree-flag" + action="disagree" + icon="thumbs-o-down" + label="admin.flags.disagree_flag"}} + {{/if}} + + {{d-button + class="defer-flag" + title="admin.flags.defer_flag_title" + action="defer" + icon="external-link" + label="admin.flags.defer_flag"}} + + {{d-button + class="btn-danger delete-flag" + title="admin.flags.delete_title" + action="showDeleteFlagModal" + icon="trash-o" + label="admin.flags.delete"}} +
{{/if}}
-{{/each}} - -{{#if canAct}} -
- {{d-button - title="admin.flags.agree_title" - class="agree-flag" - label="admin.flags.agree" - icon="thumbs-o-up" - action="showAgreeFlagModal" - ellipsis=true}} - - {{#if flaggedPost.postHidden}} - {{d-button - title="admin.flags.disagree_flag_unhide_post_title" - class="disagree-flag" - action="disagree" - icon="thumbs-o-down" - label="admin.flags.disagree_flag_unhide_post"}} - {{else}} - {{d-button - title="admin.flags.disagree_flag_title" - class="disagree-flag" - action="disagree" - icon="thumbs-o-down" - label="admin.flags.disagree_flag"}} - {{/if}} - - {{d-button - class="defer-flag" - title="admin.flags.defer_flag_title" - action="defer" - icon="external-link" - label="admin.flags.defer_flag"}} - - {{d-button - class="btn-danger delete-flag" - title="admin.flags.delete_title" - action="showDeleteFlagModal" - icon="trash-o" - label="admin.flags.delete"}} -
-{{/if}} +
diff --git a/app/assets/javascripts/admin/templates/components/flagged-posts.hbs b/app/assets/javascripts/admin/templates/components/flagged-posts.hbs index e2ae697d6f2..fd8d0b182ce 100644 --- a/app/assets/javascripts/admin/templates/components/flagged-posts.hbs +++ b/app/assets/javascripts/admin/templates/components/flagged-posts.hbs @@ -1,14 +1,5 @@ {{#if flaggedPosts}} {{#load-more selector=".flagged-post" action=(action "loadMore")}} -
-
- {{i18n 'admin.flags.flagged_by'}} -
- {{#if showResolvedBy}} - {{i18n 'admin.flags.resolved_by'}} - {{/if}} -
-
{{#each flaggedPosts as |flaggedPost|}} {{flagged-post diff --git a/app/assets/javascripts/discourse/models/post.js.es6 b/app/assets/javascripts/discourse/models/post.js.es6 index 1a84aa4ccf3..928210d9ed4 100644 --- a/app/assets/javascripts/discourse/models/post.js.es6 +++ b/app/assets/javascripts/discourse/models/post.js.es6 @@ -53,7 +53,11 @@ const Post = RestModel.extend({ }.property('firstPost', 'deleted_at', 'topic.deleted_at'), url: function() { - return postUrl(this.get('topic.slug') || this.get('topic_slug'), this.get('topic_id'), this.get('post_number')); + return postUrl( + this.get('topic.slug') || this.get('topic_slug'), + this.get('topic_id') || this.get('topic.id'), + this.get('post_number') + ); }.property('post_number', 'topic_id', 'topic.slug'), // Don't drop the /1 diff --git a/app/assets/stylesheets/common/admin/flagging.scss b/app/assets/stylesheets/common/admin/flagging.scss index 03393450846..60a233a4bb9 100644 --- a/app/assets/stylesheets/common/admin/flagging.scss +++ b/app/assets/stylesheets/common/admin/flagging.scss @@ -1,15 +1,3 @@ -.flagged-posts-header { - display: flex; - justify-content: flex-end; - - font-weight: bold; - .flagged-by-header { - width: 12em; - } - padding-bottom: 0.5em; - border-bottom: 1px solid $primary-low; -} - .flagged-post.hidden-post { .flagged-post-excerpt, .flagged-post-avatar { opacity: 0.5; @@ -23,12 +11,11 @@ } .flagged-post { - padding: 1em 0 0 0; + padding: 1em 0 0.55em 0; border-bottom: 1px solid $primary-low; .flagged-post-details { display: flex; - justify-content: space-between; .flagged-post-avatar { margin-right: 1em; @@ -46,9 +33,7 @@ } } - .flagged-post-excerpt { - min-width: 70%; - width: 80%; + .flagged-post-contents { word-wrap: break-word; .d-icon { display: inline-block; @@ -64,26 +49,53 @@ } } - .flagger { - width: 12em; + .flag-user-lists { + display: flex; + align-items: flex-start; + margin-top: 1em; + } + + .user-list-title { + font-weight: bold; + margin: 0; + } + + .flag-users { + margin: 0.5em 0; + display: flex; + flex-wrap: wrap; + } + + .flag-user { display: flex; margin-bottom: 1em; + margin-right: 2em; + align-items: center; + justify-content: space-between; + + .flag-user-who { + display: flex; + width: 13em; + } + .flag-user-username { + font-weight: bold; + margin-right: 0.5em; + } + .flag-user-date { + color: $primary-medium; + } + + .flag-user-avatar { + margin-right: 0.5em; + } } - .flagger-avatar, .disposer-avatar { - margin-right: 1em; - min-width: 32px; - } + .flag-conversation { + padding: 1em; - .disposer { - width: 7em; - justify-content: flex-end; - display: flex; - margin-bottom: 1em; - } - - .flagged-post-resolved-by { - width: 12em; + .reply-conversation { + margin-left: 32px; + } } .flagged-post-message { @@ -117,7 +129,6 @@ .flagged-post-controls { display: flex; flex-wrap: wrap; - justify-content: flex-end; button { margin-right: 0.5em; @@ -164,9 +175,6 @@ } .mobile-view { - .flagged-posts-header { - display: none; - } .flagged-posts { .flagged-post-details { flex-wrap: wrap; @@ -180,11 +188,6 @@ width: 70%; } - .flaggers-title { - font-weight: bold; - margin: 0.5em 0; - } - .flaggers { margin-left: 4em; margin-bottom: 1em; diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 5ecba1d0525..8a8385855ed 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -2641,6 +2641,7 @@ en: reply_message: "Reply" no_results: "There are no flaged posts." topic_flagged: "This topic has been flagged." + show_full: "show full post" visit_topic: "Visit the topic to take action" was_edited: "Post was edited after the first flag" previous_flags_count: "This post has already been flagged {{count}} times." diff --git a/test/javascripts/acceptance/admin-flags-test.js.es6 b/test/javascripts/acceptance/admin-flags-test.js.es6 index e891e568c4e..ab77a827066 100644 --- a/test/javascripts/acceptance/admin-flags-test.js.es6 +++ b/test/javascripts/acceptance/admin-flags-test.js.es6 @@ -5,7 +5,7 @@ QUnit.test("flagged posts", assert => { visit("/admin/flags/active"); andThen(() => { assert.equal(find('.flagged-posts .flagged-post').length, 1); - assert.equal(find('.flagged-post .flaggers .flagger').length, 1, 'shows who flagged it'); + assert.equal(find('.flagged-post .flag-user').length, 1, 'shows who flagged it'); assert.equal(find('.flagged-post-response').length, 2); assert.equal(find('.flagged-post-response:eq(0) img.avatar').length, 1); });