jenkins-bot has submitted this change and it was merged.

Change subject: Change results of moderation dialogs to match filtering
......................................................................


Change results of moderation dialogs to match filtering

Adjusts topic and board level handling of moderation dialogs
to match the requirements of
https://trello.com/c/Q5hRcPmX/645-i-1-hide-topic-updates-5

Does not handle the history/contributions changes listed in
same story.

Change-Id: I930a3d392fa53eab5926ba76aaaff6dbbdf7111e
---
M Resources.php
M handlebars/Makefile
M handlebars/compiled/flow_block_topic.handlebars.php
M handlebars/compiled/flow_block_topic_moderate_post.handlebars.php
M handlebars/compiled/flow_block_topic_moderate_topic.handlebars.php
M handlebars/compiled/flow_block_topiclist.handlebars.php
A handlebars/flow_moderate_topic_confirmation.handlebars
A handlebars/flow_topic_moderation_flag.handlebars
M handlebars/flow_topic_titlebar_content.handlebars
M i18n/en.json
M i18n/qqq.json
M includes/Formatter/RevisionFormatter.php
M modules/new/components/flow-board.js
M modules/new/styles/board/topic/titlebar.less
M modules/new/styles/common.less
15 files changed, 120 insertions(+), 36 deletions(-)

Approvals:
  SG: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/Resources.php b/Resources.php
index 3d80aba..36e0131 100644
--- a/Resources.php
+++ b/Resources.php
@@ -49,6 +49,7 @@
                        "flow_header_detail.handlebars",
                        "flow_moderate_post.handlebars",
                        "flow_moderate_topic.handlebars",
+                       "flow_moderate_topic_confirmation.handlebars",
                        "flow_newtopic_form.handlebars",
                        "flow_post.handlebars",
                        "flow_post_inner.handlebars",
@@ -71,6 +72,7 @@
                        "flow_topic_titlebar_watch.handlebars",
                        "flow_topic_titlebar_content.handlebars",
                        "flow_topic_titlebar_summary.handlebars",
+                       "flow_topic_moderation_flag.handlebars",
                        "flow_topiclist_loop.handlebars",
                        "flow_form_buttons.handlebars",
                        "flow_preview_warning.handlebars",
@@ -129,6 +131,7 @@
                        'flow-topic-action-suppress-topic',
                        'flow-topic-action-unsuppress-topic',
                        'flow-topic-action-restore-topic',
+                       'flow-topic-action-undo-moderation',
                        'flow-hide-post-content',
                        'flow-delete-post-content',
                        'flow-suppress-post-content',
@@ -202,6 +205,10 @@
                        'flow-moderation-confirm-hide-topic',
                        'flow-moderation-confirm-delete-topic',
                        'flow-moderation-confirm-suppress-topic',
+                       'flow-moderation-confirmation-hide-topic',
+                       'flow-moderation-confirmation-delete-topic',
+                       'flow-moderation-confirmation-suppress-topic',
+                       'flow-topic-moderated-reason-prefix',
                ),
        ),
        // @todo: upstream to mediawiki ui
diff --git a/handlebars/Makefile b/handlebars/Makefile
index 8f81db9..ec95f30 100644
--- a/handlebars/Makefile
+++ b/handlebars/Makefile
@@ -17,6 +17,7 @@
 TOPIC_SUBTEMPLATES=flow_topic.handlebars \
                flow_topic_titlebar.handlebars \
                flow_topic_titlebar_content.handlebars \
+               flow_topic_moderation_flag.handlebars \
                flow_topic_titlebar_lock.handlebars \
                flow_topic_titlebar_summary.handlebars \
                flow_topic_titlebar_watch.handlebars \
diff --git a/handlebars/compiled/flow_block_topic.handlebars.php 
b/handlebars/compiled/flow_block_topic.handlebars.php
index b26b566..da98d64 100644
--- a/handlebars/compiled/flow_block_topic.handlebars.php
+++ b/handlebars/compiled/flow_block_topic.handlebars.php
@@ -49,11 +49,6 @@
 >
        <div class="flow-topic-titlebar flow-click-interactive" 
data-flow-interactive-handler="collapserCollapsibleToggle" tabindex="0">
        <h2 class="flow-topic-title" data-title="'.LCRun3::ch($cx, 
'plaintextSnippet', Array(Array(((is_array($in['content']) && 
isset($in['content']['format'])) ? $in['content']['format'] : 
null),((is_array($in['content']) && isset($in['content']['content'])) ? 
$in['content']['content'] : null)),Array()), 'encq').'">'.LCRun3::ch($cx, 
'escapeContent', Array(Array(((is_array($in['content']) && 
isset($in['content']['format'])) ? $in['content']['format'] : 
null),((is_array($in['content']) && isset($in['content']['content'])) ? 
$in['content']['content'] : null)),Array()), 'encq').'</h2>
-'.((LCRun3::ifvar($cx, ((is_array($in) && isset($in['isModerated'])) ? 
$in['isModerated'] : null))) ? '
-       <div class="flow-moderated-topic-title flow-ui-text-truncated"><span
-               class="wikiglyph '.LCRun3::hbch($cx, 'ifCond', 
Array(Array(((is_array($in) && isset($in['moderateState'])) ? 
$in['moderateState'] : null),'===','lock'),Array()), $in, function($cx, $in) 
{return 'wikiglyph-lock';}).''.LCRun3::hbch($cx, 'ifCond', 
Array(Array(((is_array($in) && isset($in['moderateState'])) ? 
$in['moderateState'] : null),'===','hide'),Array()), $in, function($cx, $in) 
{return 'wikiglyph-flag';}).''.LCRun3::hbch($cx, 'ifCond', 
Array(Array(((is_array($in) && isset($in['moderateState'])) ? 
$in['moderateState'] : null),'===','delete'),Array()), $in, function($cx, $in) 
{return 'wikiglyph-trash';}).'"></span>
-               '.LCRun3::ch($cx, 'l10n', 
Array(Array('post_moderation_state',((is_array($in) && 
isset($in['moderateState'])) ? $in['moderateState'] : null),((is_array($in) && 
isset($in['replyToId'])) ? $in['replyToId'] : 
null),((is_array($in['moderator']) && isset($in['moderator']['name'])) ? 
$in['moderator']['name'] : null)),Array()), 'encq').'</div>
-' : '').'
 <div class="flow-topic-meta">
        '.((LCRun3::ifvar($cx, ((is_array($in['actions']) && 
isset($in['actions']['reply'])) ? $in['actions']['reply'] : null))) ? '
                <a href="'.htmlentities(((is_array($in['actions']['reply']) && 
isset($in['actions']['reply']['url'])) ? $in['actions']['reply']['url'] : 
null), ENT_QUOTES, 'UTF-8').'"
@@ -71,6 +66,15 @@
                '.LCRun3::ch($cx, 'uuidTimestamp', Array(Array(((is_array($in) 
&& isset($in['postId'])) ? $in['postId'] : 
null),'flow-started-ago',false),Array()), 'encq').'
        ').'
 </div>
+'.((LCRun3::ifvar($cx, ((is_array($in) && isset($in['isModerated'])) ? 
$in['isModerated'] : null))) ? '
+       <div class="flow-moderated-topic-title 
flow-ui-text-truncated">'.htmlentities(((is_array($in) && isset($in['noop'])) ? 
$in['noop'] : null), ENT_QUOTES, 'UTF-8').'<span 
class="wikiglyph'.LCRun3::hbch($cx, 'ifCond', Array(Array(((is_array($in) && 
isset($in['moderateState'])) ? $in['moderateState'] : 
null),'===','lock'),Array()), $in, function($cx, $in) {return ' 
wikiglyph-lock';}).''.LCRun3::hbch($cx, 'ifCond', Array(Array(((is_array($in) 
&& isset($in['moderateState'])) ? $in['moderateState'] : 
null),'===','hide'),Array()), $in, function($cx, $in) {return ' 
wikiglyph-flag';}).''.LCRun3::hbch($cx, 'ifCond', Array(Array(((is_array($in) 
&& isset($in['moderateState'])) ? $in['moderateState'] : 
null),'===','delete'),Array()), $in, function($cx, $in) {return ' 
wikiglyph-trash';}).'"></span>
+
+               '.LCRun3::ch($cx, 'l10n', 
Array(Array('post_moderation_state',((is_array($in) && 
isset($in['moderateState'])) ? $in['moderateState'] : null),((is_array($in) && 
isset($in['replyToId'])) ? $in['replyToId'] : 
null),((is_array($in['moderator']) && isset($in['moderator']['name'])) ? 
$in['moderator']['name'] : null)),Array()), 'encq').'</div>
+       <div class="flow-moderated-topic-reason">
+               '.LCRun3::ch($cx, 'l10n', 
Array(Array('flow-topic-moderated-reason-prefix'),Array()), 'encq').'
+               '.htmlentities(((is_array($in) && isset($in['moderateReason'])) 
? $in['moderateReason'] : null), ENT_QUOTES, 'UTF-8').'
+       </div>
+' : '').'
 <span class="flow-reply-count"><span class="wikiglyph 
wikiglyph-speech-bubble"></span><span 
class="flow-reply-count-number">'.htmlentities(((is_array($in) && 
isset($in['reply_count'])) ? $in['reply_count'] : null), ENT_QUOTES, 
'UTF-8').'</span></span>
 
 <div class="flow-topic-summary-container">
@@ -467,4 +471,4 @@
 </div>
 ';
 }
-?>
+?>
\ No newline at end of file
diff --git a/handlebars/compiled/flow_block_topic_moderate_post.handlebars.php 
b/handlebars/compiled/flow_block_topic_moderate_post.handlebars.php
index 949860a..45e7344 100644
--- a/handlebars/compiled/flow_block_topic_moderate_post.handlebars.php
+++ b/handlebars/compiled/flow_block_topic_moderate_post.handlebars.php
@@ -53,7 +53,8 @@
                  data-flow-expandable="true"
                  class="mw-ui-input"
                  data-role="content"
-                 placeholder="'.LCRun3::ch($cx, 'l10n', 
Array(Array(LCRun3::ch($cx, 'concat', 
Array(Array('flow-moderation-placeholder-',((is_array($cx['scopes'][0]['submitted'])
 && isset($cx['scopes'][0]['submitted']['moderationState'])) ? 
$cx['scopes'][0]['submitted']['moderationState'] : null),'-post'),Array()), 
'raw')),Array()), 'encq').'">'.((LCRun3::ifvar($cx, 
((is_array($cx['scopes'][0]['submitted']) && 
isset($cx['scopes'][0]['submitted']['reason'])) ? 
$cx['scopes'][0]['submitted']['reason'] : null))) ? 
''.htmlentities(((is_array($cx['scopes'][0]['submitted']) && 
isset($cx['scopes'][0]['submitted']['reason'])) ? 
$cx['scopes'][0]['submitted']['reason'] : null), ENT_QUOTES, 'UTF-8').'' : 
'').'</textarea>
+                 placeholder="'.LCRun3::ch($cx, 'l10n', 
Array(Array(LCRun3::ch($cx, 'concat', 
Array(Array('flow-moderation-placeholder-',((is_array($cx['scopes'][0]['submitted'])
 && isset($cx['scopes'][0]['submitted']['moderationState'])) ? 
$cx['scopes'][0]['submitted']['moderationState'] : null),'-post'),Array()), 
'raw')),Array()), 'encq').'"
+                 autofocus>'.((LCRun3::ifvar($cx, 
((is_array($cx['scopes'][0]['submitted']) && 
isset($cx['scopes'][0]['submitted']['reason'])) ? 
$cx['scopes'][0]['submitted']['reason'] : null))) ? 
''.htmlentities(((is_array($cx['scopes'][0]['submitted']) && 
isset($cx['scopes'][0]['submitted']['reason'])) ? 
$cx['scopes'][0]['submitted']['reason'] : null), ENT_QUOTES, 'UTF-8').'' : 
'').'</textarea>
        <div class="flow-form-actions flow-form-collapsible">
                <button data-flow-interactive-handler="apiRequest"
                        data-flow-api-handler="moderatePost"
diff --git a/handlebars/compiled/flow_block_topic_moderate_topic.handlebars.php 
b/handlebars/compiled/flow_block_topic_moderate_topic.handlebars.php
index 18fc275..b3b0736 100644
--- a/handlebars/compiled/flow_block_topic_moderate_topic.handlebars.php
+++ b/handlebars/compiled/flow_block_topic_moderate_topic.handlebars.php
@@ -53,7 +53,8 @@
                  data-flow-expandable="true"
                  class="mw-ui-input"
                  data-role="content"
-                 placeholder="'.LCRun3::ch($cx, 'l10n', 
Array(Array(LCRun3::ch($cx, 'concat', 
Array(Array('flow-moderation-placeholder-',((is_array($cx['scopes'][0]['submitted'])
 && isset($cx['scopes'][0]['submitted']['moderationState'])) ? 
$cx['scopes'][0]['submitted']['moderationState'] : null),'-topic'),Array()), 
'raw')),Array()), 'encq').'">'.((LCRun3::ifvar($cx, 
((is_array($cx['scopes'][0]['submitted']) && 
isset($cx['scopes'][0]['submitted']['reason'])) ? 
$cx['scopes'][0]['submitted']['reason'] : null))) ? 
''.htmlentities(((is_array($cx['scopes'][0]['submitted']) && 
isset($cx['scopes'][0]['submitted']['reason'])) ? 
$cx['scopes'][0]['submitted']['reason'] : null), ENT_QUOTES, 'UTF-8').'' : 
'').'</textarea>
+                 placeholder="'.LCRun3::ch($cx, 'l10n', 
Array(Array(LCRun3::ch($cx, 'concat', 
Array(Array('flow-moderation-placeholder-',((is_array($cx['scopes'][0]['submitted'])
 && isset($cx['scopes'][0]['submitted']['moderationState'])) ? 
$cx['scopes'][0]['submitted']['moderationState'] : null),'-topic'),Array()), 
'raw')),Array()), 'encq').'"
+                 autofocus>'.((LCRun3::ifvar($cx, 
((is_array($cx['scopes'][0]['submitted']) && 
isset($cx['scopes'][0]['submitted']['reason'])) ? 
$cx['scopes'][0]['submitted']['reason'] : null))) ? 
''.htmlentities(((is_array($cx['scopes'][0]['submitted']) && 
isset($cx['scopes'][0]['submitted']['reason'])) ? 
$cx['scopes'][0]['submitted']['reason'] : null), ENT_QUOTES, 'UTF-8').'' : 
'').'</textarea>
        <div class="flow-form-actions flow-form-collapsible">
                <button class="mw-ui-button mw-ui-constructive"
                        data-flow-interactive-handler="apiRequest"
diff --git a/handlebars/compiled/flow_block_topiclist.handlebars.php 
b/handlebars/compiled/flow_block_topiclist.handlebars.php
index f7282de..18ce80e 100644
--- a/handlebars/compiled/flow_block_topiclist.handlebars.php
+++ b/handlebars/compiled/flow_block_topiclist.handlebars.php
@@ -180,11 +180,6 @@
 >
        <div class="flow-topic-titlebar flow-click-interactive" 
data-flow-interactive-handler="collapserCollapsibleToggle" tabindex="0">
        <h2 class="flow-topic-title" data-title="'.LCRun3::ch($cx, 
'plaintextSnippet', Array(Array(((is_array($in['content']) && 
isset($in['content']['format'])) ? $in['content']['format'] : 
null),((is_array($in['content']) && isset($in['content']['content'])) ? 
$in['content']['content'] : null)),Array()), 'encq').'">'.LCRun3::ch($cx, 
'escapeContent', Array(Array(((is_array($in['content']) && 
isset($in['content']['format'])) ? $in['content']['format'] : 
null),((is_array($in['content']) && isset($in['content']['content'])) ? 
$in['content']['content'] : null)),Array()), 'encq').'</h2>
-'.((LCRun3::ifvar($cx, ((is_array($in) && isset($in['isModerated'])) ? 
$in['isModerated'] : null))) ? '
-       <div class="flow-moderated-topic-title flow-ui-text-truncated"><span
-               class="wikiglyph '.LCRun3::hbch($cx, 'ifCond', 
Array(Array(((is_array($in) && isset($in['moderateState'])) ? 
$in['moderateState'] : null),'===','lock'),Array()), $in, function($cx, $in) 
{return 'wikiglyph-lock';}).''.LCRun3::hbch($cx, 'ifCond', 
Array(Array(((is_array($in) && isset($in['moderateState'])) ? 
$in['moderateState'] : null),'===','hide'),Array()), $in, function($cx, $in) 
{return 'wikiglyph-flag';}).''.LCRun3::hbch($cx, 'ifCond', 
Array(Array(((is_array($in) && isset($in['moderateState'])) ? 
$in['moderateState'] : null),'===','delete'),Array()), $in, function($cx, $in) 
{return 'wikiglyph-trash';}).'"></span>
-               '.LCRun3::ch($cx, 'l10n', 
Array(Array('post_moderation_state',((is_array($in) && 
isset($in['moderateState'])) ? $in['moderateState'] : null),((is_array($in) && 
isset($in['replyToId'])) ? $in['replyToId'] : 
null),((is_array($in['moderator']) && isset($in['moderator']['name'])) ? 
$in['moderator']['name'] : null)),Array()), 'encq').'</div>
-' : '').'
 <div class="flow-topic-meta">
        '.((LCRun3::ifvar($cx, ((is_array($in['actions']) && 
isset($in['actions']['reply'])) ? $in['actions']['reply'] : null))) ? '
                <a href="'.htmlentities(((is_array($in['actions']['reply']) && 
isset($in['actions']['reply']['url'])) ? $in['actions']['reply']['url'] : 
null), ENT_QUOTES, 'UTF-8').'"
@@ -202,6 +197,15 @@
                '.LCRun3::ch($cx, 'uuidTimestamp', Array(Array(((is_array($in) 
&& isset($in['postId'])) ? $in['postId'] : 
null),'flow-started-ago',false),Array()), 'encq').'
        ').'
 </div>
+'.((LCRun3::ifvar($cx, ((is_array($in) && isset($in['isModerated'])) ? 
$in['isModerated'] : null))) ? '
+       <div class="flow-moderated-topic-title 
flow-ui-text-truncated">'.htmlentities(((is_array($in) && isset($in['noop'])) ? 
$in['noop'] : null), ENT_QUOTES, 'UTF-8').'<span 
class="wikiglyph'.LCRun3::hbch($cx, 'ifCond', Array(Array(((is_array($in) && 
isset($in['moderateState'])) ? $in['moderateState'] : 
null),'===','lock'),Array()), $in, function($cx, $in) {return ' 
wikiglyph-lock';}).''.LCRun3::hbch($cx, 'ifCond', Array(Array(((is_array($in) 
&& isset($in['moderateState'])) ? $in['moderateState'] : 
null),'===','hide'),Array()), $in, function($cx, $in) {return ' 
wikiglyph-flag';}).''.LCRun3::hbch($cx, 'ifCond', Array(Array(((is_array($in) 
&& isset($in['moderateState'])) ? $in['moderateState'] : 
null),'===','delete'),Array()), $in, function($cx, $in) {return ' 
wikiglyph-trash';}).'"></span>
+
+               '.LCRun3::ch($cx, 'l10n', 
Array(Array('post_moderation_state',((is_array($in) && 
isset($in['moderateState'])) ? $in['moderateState'] : null),((is_array($in) && 
isset($in['replyToId'])) ? $in['replyToId'] : 
null),((is_array($in['moderator']) && isset($in['moderator']['name'])) ? 
$in['moderator']['name'] : null)),Array()), 'encq').'</div>
+       <div class="flow-moderated-topic-reason">
+               '.LCRun3::ch($cx, 'l10n', 
Array(Array('flow-topic-moderated-reason-prefix'),Array()), 'encq').'
+               '.htmlentities(((is_array($in) && isset($in['moderateReason'])) 
? $in['moderateReason'] : null), ENT_QUOTES, 'UTF-8').'
+       </div>
+' : '').'
 <span class="flow-reply-count"><span class="wikiglyph 
wikiglyph-speech-bubble"></span><span 
class="flow-reply-count-number">'.htmlentities(((is_array($in) && 
isset($in['reply_count'])) ? $in['reply_count'] : null), ENT_QUOTES, 
'UTF-8').'</span></span>
 
 <div class="flow-topic-summary-container">
diff --git a/handlebars/flow_moderate_topic_confirmation.handlebars 
b/handlebars/flow_moderate_topic_confirmation.handlebars
new file mode 100644
index 0000000..a733842
--- /dev/null
+++ b/handlebars/flow_moderate_topic_confirmation.handlebars
@@ -0,0 +1,43 @@
+<div class="flow-topic flow-topic-moderated">
+       <div class="flow-topic-titlebar">
+               <div class="flow-moderated-topic-title flow-ui-text-truncated">
+                       {{~noop~}}{{> flow_topic_moderation_flag}}
+                       <span>{{~l10n (concat 'flow-moderation-confirmation-' 
moderateState '-topic')~}}</span>
+                       <div class="flow-topic-titlebar-undo">
+                               {{#if actions.unhide}}
+                                       <a class="mw-ui-anchor 
mw-ui-progressive mw-ui-quiet"
+                                         href="{{actions.unhide.url}}"
+                                         title="{{actions.unhide.title}}"
+                                         
data-flow-interactive-handler="moderationDialog"
+                                         data-template="flow_moderate_topic"
+                                         data-role="unhide"
+                                       >
+                                               {{~l10n 
'flow-topic-action-undo-moderation'~}}
+                                       </a>
+                               {{/if}}
+                               {{#if actions.undelete}}
+                                       <a class="mw-ui-anchor 
mw-ui-progressive mw-ui-quiet"
+                                         href="{{actions.undelete.url}}"
+                                         title="{{actions.undelete.title}}"
+                                         
data-flow-interactive-handler="moderationDialog"
+                                         data-template="flow_moderate_topic"
+                                         data-role="undelete"
+                                       >
+                                               {{~l10n 
'flow-topic-action-undo-moderation'~}}
+                                       </a>
+                               {{/if}}
+                               {{#if actions.unsuppress}}
+                                       <a class="mw-ui-anchor 
mw-ui-progressive mw-ui-quiet"
+                                         href="{{actions.unsuppress.url}}"
+                                         title="{{actions.unsuppress.title}}"
+                                         
data-flow-interactive-handler="moderationDialog"
+                                         data-template="flow_moderate_topic"
+                                         data-role="unsuppress"
+                                       >
+                                               {{~l10n 
'flow-topic-action-undo-moderation'~}}
+                                       </a>
+                               {{/if}}
+                       </div>
+               </div>
+       </div>
+</div>
diff --git a/handlebars/flow_topic_moderation_flag.handlebars 
b/handlebars/flow_topic_moderation_flag.handlebars
new file mode 100644
index 0000000..a2f8f7c
--- /dev/null
+++ b/handlebars/flow_topic_moderation_flag.handlebars
@@ -0,0 +1,4 @@
+<span class="wikiglyph
+       {{~#ifCond moderateState "===" "lock"}} wikiglyph-lock{{/ifCond~}}
+       {{~#ifCond moderateState "===" "hide"}} wikiglyph-flag{{/ifCond~}}
+       {{~#ifCond moderateState "===" "delete"}} 
wikiglyph-trash{{/ifCond~}}"></span>
diff --git a/handlebars/flow_topic_titlebar_content.handlebars 
b/handlebars/flow_topic_titlebar_content.handlebars
index 1e8cc55..13b9211 100644
--- a/handlebars/flow_topic_titlebar_content.handlebars
+++ b/handlebars/flow_topic_titlebar_content.handlebars
@@ -1,10 +1,4 @@
 <h2 class="flow-topic-title" data-title="{{plaintextSnippet content.format 
content.content}}">{{escapeContent content.format content.content}}</h2>
-{{#if isModerated}}
-       <div class="flow-moderated-topic-title flow-ui-text-truncated"><span
-               class="wikiglyph {{#ifCond moderateState "===" 
"lock"}}wikiglyph-lock{{/ifCond}}{{#ifCond moderateState "===" 
"hide"}}wikiglyph-flag{{/ifCond}}{{#ifCond moderateState "===" 
"delete"}}wikiglyph-trash{{/ifCond}}"></span>
-               {{l10n "post_moderation_state" moderateState replyToId 
moderator.name~}}
-       </div>
-{{/if}}
 <div class="flow-topic-meta">
        {{#if actions.reply}}
                <a href="{{actions.reply.url}}"
@@ -24,6 +18,16 @@
                {{uuidTimestamp postId "flow-started-ago" false}}
        {{/if}}
 </div>
+{{#if isModerated}}
+       <div class="flow-moderated-topic-title flow-ui-text-truncated">
+               {{~noop~}}{{> flow_topic_moderation_flag}}
+               {{l10n "post_moderation_state" moderateState replyToId 
moderator.name~}}
+       </div>
+       <div class="flow-moderated-topic-reason">
+               {{l10n "flow-topic-moderated-reason-prefix"}}
+               {{moderateReason}}
+       </div>
+{{/if}}
 <span class="flow-reply-count"><span class="wikiglyph 
wikiglyph-speech-bubble"></span><span 
class="flow-reply-count-number">{{reply_count}}</span></span>
 
 {{> flow_topic_titlebar_summary}}
diff --git a/i18n/en.json b/i18n/en.json
index 6adab12..5ccd5d9 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -29,6 +29,7 @@
     "flow-post-moderated-toggle-hide-hide": "Hide comment {{GENDER:$1|hidden}} 
by $2",
     "flow-post-moderated-toggle-delete-hide": "Hide comment 
{{GENDER:$1|deleted}} by $2",
     "flow-post-moderated-toggle-suppress-hide": "Hide comment 
{{GENDER:$1|suppressed}} by $2",
+    "flow-topic-moderated-reason-prefix": "Reason:",
     "flow-hide-post-content": "This comment was {{GENDER:$1|hidden}} by $1",
     "flow-hide-title-content": "This topic was {{GENDER:$1|hidden}} by $1",
     "flow-lock-title-content": "This topic was {{GENDER:$1|locked}} by $1",
@@ -91,6 +92,7 @@
     "flow-topic-action-undelete-topic": "Undelete topic",
     "flow-topic-action-unsuppress-topic": "Unsuppress topic",
     "flow-topic-action-restore-topic": "Restore topic",
+    "flow-topic-action-undo-moderation": "Undo",
     "flow-topic-notification-subscribe-title": "This topic has been added to 
your watchlist.",
     "flow-topic-notification-subscribe-description": "You will receive 
notifications on all activities on this topic.",
     "flow-board-notification-subscribe-title": "You're subscribed to this 
discussion board!",
@@ -277,9 +279,9 @@
     "flow-moderation-confirmation-unsuppress-post": "You have successfully 
unsuppressed the above post.",
     "flow-moderation-confirmation-undelete-post": "You have successfully 
undeleted the above post.",
     "flow-moderation-confirmation-unhide-post": "You have successfully 
unhidden the above post.",
-    "flow-moderation-confirmation-suppress-topic": "The topic was successfully 
suppressed.\n{{GENDER:$2|Consider}} giving $1 feedback on this topic.",
-    "flow-moderation-confirmation-delete-topic": "The topic was successfully 
deleted.\n{{GENDER:$2|Consider}} giving $1 feedback on this topic.",
-    "flow-moderation-confirmation-hide-topic": "The topic was successfully 
hidden.\n{{GENDER:$2|Consider}} giving $1 feedback on this topic.",
+    "flow-moderation-confirmation-suppress-topic": "This topic has been 
suppressed.",
+    "flow-moderation-confirmation-delete-topic": "This topic has been 
deleted.",
+    "flow-moderation-confirmation-hide-topic": "This topic has been hidden.",
     "flow-moderation-confirmation-unsuppress-topic": "You have successfully 
unsuppressed this topic.",
     "flow-moderation-confirmation-undelete-topic": "You have successfully 
undeleted this topic.",
     "flow-moderation-confirmation-unhide-topic": "You have successfully 
unhidden this topic.",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 6228bb1..1016cad 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -33,6 +33,7 @@
        "flow-post-moderated-toggle-hide-hide": "Message to display instead of 
content when a hidden post has been hidden.\n\nParameters:\n* $1 - username 
that hid the title, can be used for GENDER\n* $2 - user link and tool links for 
the user\n{{Related|Flow-post-moderated-toggle}}",
        "flow-post-moderated-toggle-delete-hide": "Message to display instead 
of content when a deleted post has been hidden.\n\nParameters:\n* $1 - username 
that hid the title, can be used for GENDER\n* $2 - user link and tool links for 
the user\n{{Related|Flow-post-moderated-toggle}}",
        "flow-post-moderated-toggle-suppress-hide": "Message to display instead 
of content when a suppressed post has been hidden.\n\nParameters:\n* $1 - 
username that hid the title, can be used for GENDER\n* $2 - user link and tool 
links for the user\n{{Related|Flow-post-moderated-toggle}}",
+       "flow-topic-moderated-reason-prefix": "Message to display in the topic 
title immediatly preceding the user supplied reason for moderating the 
topic.{{Identical|Reason:}}",
        "flow-hide-post-content": "Message to display instead of content when 
the post has been hidden.\n\nParameters:\n* $1 - username that hid the post, 
can be used for GENDER\n{{Related|Flow-content}}",
        "flow-hide-title-content": "Message to display instead of content when 
the title has been hidden.\n\nParameters:\n* $1 - username that hid the title, 
can be used for GENDER\n{{Related|Flow-content}}",
        "flow-lock-title-content": "Message to display instead of content when 
the title has been locked.\n\nParameters:\n* $1 - username that locked the 
title, can be used for GENDER\n{{Related|Flow-content}}",
diff --git a/includes/Formatter/RevisionFormatter.php 
b/includes/Formatter/RevisionFormatter.php
index bfefcd5..8399026 100644
--- a/includes/Formatter/RevisionFormatter.php
+++ b/includes/Formatter/RevisionFormatter.php
@@ -190,7 +190,9 @@
                                $moderatedRevision->getModeratedByUserId(),
                                $moderatedRevision->getModeratedByUserIp()
                        );
+                       // @todo why moderate instead of moderated or something 
else?
                        $res['moderateState'] = 
$moderatedRevision->getModerationState();
+                       $res['moderateReason'] = 
$moderatedRevision->getModeratedReason();
                }
 
                if ( $isContentAllowed ) {
diff --git a/modules/new/components/flow-board.js 
b/modules/new/components/flow-board.js
index e719bc5..77c4147 100644
--- a/modules/new/components/flow-board.js
+++ b/modules/new/components/flow-board.js
@@ -1113,20 +1113,23 @@
 
                FlowBoardComponent.UI.events.apiHandlers.moderateTopic = 
_genModerateHandler(
                        'moderate-topic',
-                       function ( $target, revision ) {
-                               var html = 
mw.flow.TemplateEngine.processTemplate( 'flow_topic', revision ),
-                                       $replacement = $( html ),
-                                       $titlebar = $replacement.find( 
'.flow-topic-titlebar' );
+                       function ( $target, revision, apiResult ) {
+                               var $replacement,
+                               // This is ugly way to detect if we are on 
NS_TOPIC,
+                               // but think this is better than:
+                               //     mw.config.get( 'wgNamespaceNumber' ) === 
2600
+                                       showFullTopic = $target.closest( 
'.flow-disable-topic-collapse' ).length > 0;
+                               if ( revision.isModerated && !showFullTopic ) {
+                                       $replacement = $( 
mw.flow.TemplateEngine.processTemplate(
+                                               
'flow_moderate_topic_confirmation',
+                                               revision
+                                       ) );
 
-                               $target
-                                       .closest( '.flow-topic' )
-                                       .attr( 'class', $replacement.attr( 
'class' ) );
-
-                               $target
-                                       .closest( '.flow-topic-titlebar' )
-                                       .replaceWith( $titlebar );
-
-                               FlowBoardComponent.UI.makeContentInteractive( 
$titlebar );
+                                       $target.closest( '.flow-topic' 
).replaceWith( $replacement );
+                                       
FlowBoardComponent.UI.makeContentInteractive( $replacement );
+                               } else {
+                                       flowBoardComponentRefreshTopic( 
$target, apiResult );
+                               }
                        }
                );
 
@@ -1660,6 +1663,7 @@
                                $this = $( this ),
                                board = 
FlowBoardComponent.prototype.getInstanceByElement( $this ),
                                // hide, delete, suppress
+                               // @todo this could just be detected from the 
url
                                role = $this.data( 'role' ),
                                template = $this.data( 'template' ),
                                params = {
diff --git a/modules/new/styles/board/topic/titlebar.less 
b/modules/new/styles/board/topic/titlebar.less
index ad97a44..6083be3 100644
--- a/modules/new/styles/board/topic/titlebar.less
+++ b/modules/new/styles/board/topic/titlebar.less
@@ -71,6 +71,10 @@
        font-weight: bold;
 }
 
+.flow-topic-titlebar-undo {
+       float: right;
+}
+
 // MEDIA QUERIES
 @media all and (min-width: @wgFlowDeviceWidthTablet) {
        .flow-topic-titlebar {
diff --git a/modules/new/styles/common.less b/modules/new/styles/common.less
index 204c8de..f6f9322 100644
--- a/modules/new/styles/common.less
+++ b/modules/new/styles/common.less
@@ -48,7 +48,9 @@
 }
 
 // "No more" link
-.flow-no-more {
+.flow-no-more,
+// "Undo" moderation link
+.flow-topic-titlebar-undo {
        font-size: .875em;
        color: #777777;
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/163097
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I930a3d392fa53eab5926ba76aaaff6dbbdf7111e
Gerrit-PatchSet: 7
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <[email protected]>
Gerrit-Reviewer: SG <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to