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

Change subject: Display reason for moderation in history
......................................................................


Display reason for moderation in history

Bug: 56745
Change-Id: I8b6c28bbbb67550922d8f15f8ceced11d6e6cec9
---
M Flow.i18n.php
M FlowActions.php
M includes/Model/AbstractRevision.php
3 files changed, 44 insertions(+), 12 deletions(-)

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



diff --git a/Flow.i18n.php b/Flow.i18n.php
index ddc7fc2..6d8423e 100644
--- a/Flow.i18n.php
+++ b/Flow.i18n.php
@@ -106,15 +106,15 @@
 
        'flow-rev-message-create-header' => "$1 {{GENDER:$2|created}} the board 
header.",
        'flow-rev-message-edit-header' => "$1 {{GENDER:$2|edited}} the board 
header.",
-       'flow-rev-message-hid-post' => '$1 {{GENDER:$2|hid}} a [$4 comment].',
-       'flow-rev-message-deleted-post' => '$1 {{GENDER:$2|deleted}} a [$4 
comment].',
-       'flow-rev-message-censored-post' => '$1 {{GENDER:$2|suppressed}} a [$4 
comment].',
-       'flow-rev-message-restored-post' => '$1 {{GENDER:$2|restored}} a [$4 
comment].',
+       'flow-rev-message-hid-post' => '$1 {{GENDER:$2|hid}} a [$4 comment] 
(\'\' $5 \'\').',
+       'flow-rev-message-deleted-post' => '$1 {{GENDER:$2|deleted}} a [$4 
comment] (\'\' $5 \'\').',
+       'flow-rev-message-censored-post' => '$1 {{GENDER:$2|suppressed}} a [$4 
comment] (\'\' $5 \'\').',
+       'flow-rev-message-restored-post' => '$1 {{GENDER:$2|restored}} a [$4 
comment] (\'\' $5 \'\').',
 
-       'flow-rev-message-hid-topic' => '$1 {{GENDER:$2|hid}} the [$4 topic].',
-       'flow-rev-message-deleted-topic' => '$1 {{GENDER:$2|deleted}} the [$4 
topic].',
-       'flow-rev-message-censored-topic' => '$1 {{GENDER:$2|suppressed}} the 
[$4 topic].',
-       'flow-rev-message-restored-topic' => '$1 {{GENDER:$2|restored}} the [$4 
topic].',
+       'flow-rev-message-hid-topic' => '$1 {{GENDER:$2|hid}} the [$4 topic] 
(\'\' $5 \'\').',
+       'flow-rev-message-deleted-topic' => '$1 {{GENDER:$2|deleted}} the [$4 
topic] (\'\' $5 \'\').',
+       'flow-rev-message-censored-topic' => '$1 {{GENDER:$2|suppressed}} the 
[$4 topic] (\'\' $5 \'\').',
+       'flow-rev-message-restored-topic' => '$1 {{GENDER:$2|restored}} the [$4 
topic] (\'\' $5 \'\').',
 
        'flow-board-history' => '"$1" history',
        'flow-topic-history' => '"$1" topic history',
@@ -480,6 +480,7 @@
 * $2 - username of the user who moderated the comment. Can be used for GENDER
 * $3 - (Optional) username of the user who had posted the comment. Can be used 
for GENDER
 * $4 - permalink to the comment
+* $5 - Reason, from the moderating user, for moderating this post
 {{Related|Flow-rev-message}}',
        'flow-rev-message-deleted-post' => 'Used as revision comment when a 
post has been deleted.
 
@@ -488,6 +489,7 @@
 * $2 - username of the user who moderated the comment. Can be used for GENDER
 * $3 - (Optional) username of the user who had posted the comment. Can be used 
for GENDER
 * $4 - permalink to the comment
+* $5 - Reason, from the moderating user, for moderating this post
 {{Related|Flow-rev-message}}',
        'flow-rev-message-censored-post' => 'Used as revision comment when a 
post has been suppressed.
 
@@ -496,6 +498,7 @@
 * $2 - username of the user who moderated the comment. Can be used for GENDER
 * $3 - (Optional) username of the user who had posted the comment. Can be used 
for GENDER
 * $4 - permalink to the comment
+* $5 - Reason, from the moderating user, for moderating this post
 {{Related|Flow-rev-message}}',
        'flow-rev-message-restored-post' => 'Used as revision comment when a 
post has been restored (un-hidden).
 
@@ -504,6 +507,7 @@
 * $2 - username of the user who restored the comment. Can be used for GENDER
 * $3 - (Optional) username of the user who had posted the comment. Can be used 
for GENDER
 * $4 - permalink to the comment
+* $5 - Reason, from the moderating user, for moderating this post
 {{Related|Flow-rev-message}}',
        'flow-rev-message-hid-topic' => 'Used as revision comment when a topic 
has been hidden.
 
@@ -512,6 +516,7 @@
 * $2 - username of the user who moderated the topic. Can be used for GENDER
 * $3 - (Optional) username of the user who had posted the topic. Can be used 
for GENDER
 * $4 - permalink to the topic
+* $5 - Reason, from the moderating user, for moderating this topic
 {{Related|Flow-rev-message}}',
        'flow-rev-message-deleted-topic' => 'Used as revision comment when a 
topic has been deleted.
 
@@ -520,6 +525,7 @@
 * $2 - username of the user who moderated the topic. Can be used for GENDER
 * $3 - (Optional) username of the user who had posted the topic. Can be used 
for GENDER
 * $4 - permalink to the topic
+* $5 - Reason, from the moderating user, for moderating this topic
 {{Related|Flow-rev-message}}',
        'flow-rev-message-censored-topic' => 'Used as revision comment when a 
topic has been suppressed.
 
@@ -528,6 +534,7 @@
 * $2 - username of the user who moderated the topic. Can be used for GENDER
 * $3 - (Optional) username of the user who had posted the topic. Can be used 
for GENDER
 * $4 - permalink to the topic
+* $5 - Reason, from the moderating user, for moderating this topic
 {{Related|Flow-rev-message}}',
        'flow-rev-message-restored-topic' => 'Used as revision comment when a 
topic has been restored (un-hidden).
 
@@ -536,6 +543,7 @@
 * $2 - username of the user who restored the topic. Can be used for GENDER
 * $3 - (Optional) username of the user who had posted the topic. Can be used 
for GENDER
 * $4 - permalink to the topic
+* $5 - Reason, from the moderating user, for moderating this topic
 {{Related|Flow-rev-message}}',
        'flow-board-history' => 'Used as <code><nowiki><h1></nowiki></code> 
heading and HTML title in the "Board history" page.
 
diff --git a/FlowActions.php b/FlowActions.php
index 8422272..e91328d 100644
--- a/FlowActions.php
+++ b/FlowActions.php
@@ -193,6 +193,9 @@
                                        $data = array( $block->getName() . 
'[postId]' => $revision->getPostId()->getHex() );
                                        return 
$templating->getUrlGenerator()->generateUrl( $block->getWorkflowId(), 'view', 
$data );
                                },
+                               function ( PostRevision $revision, Templating 
$templating, User $user, Block $block ) {
+                                       return $revision->getModeratedReason();
+                               },
                        ),
                        'class' => 'flow-history-hid-post',
                ),
@@ -219,6 +222,9 @@
                                },
                                function ( PostRevision $revision, Templating 
$templating, User $user, Block $block ) {
                                        return 
$templating->getUrlGenerator()->generateUrl( $block->getWorkflowId(), 'view', 
array() );
+                               },
+                               function ( PostRevision $revision, Templating 
$templating, User $user, Block $block ) {
+                                       return $revision->getModeratedReason();
                                },
                        ),
                        'class' => 'flow-history-hid-topic',
@@ -249,6 +255,9 @@
                                        $data = array( $block->getName() . 
'[postId]' => $revision->getPostId()->getHex() );
                                        return 
$templating->getUrlGenerator()->generateUrl( $block->getWorkflowId(), 'view', 
$data );
                                },
+                               function ( PostRevision $revision, Templating 
$templating, User $user, Block $block ) {
+                                       return $revision->getModeratedReason();
+                               },
                        ),
                        'class' => 'flow-history-deleted-post',
                ),
@@ -276,6 +285,9 @@
                                },
                                function ( PostRevision $revision, Templating 
$templating, User $user, Block $block ) {
                                        return 
$templating->getUrlGenerator()->generateUrl( $block->getWorkflowId(), 'view', 
array() );
+                               },
+                               function ( PostRevision $revision, Templating 
$templating, User $user, Block $block ) {
+                                       return $revision->getModeratedReason();
                                },
                        ),
                        'class' => 'flow-history-deleted-topic',
@@ -307,6 +319,9 @@
                                        $data = array( $block->getName() . 
'[postId]' => $revision->getPostId()->getHex() );
                                        return 
$templating->getUrlGenerator()->generateUrl( $block->getWorkflowId(), 'view', 
$data );
                                },
+                               function ( PostRevision $revision, Templating 
$templating, User $user, Block $block ) {
+                                       return $revision->getModeratedReason();
+                               },
                        ),
                        'class' => 'flow-history-censored-post',
                ),
@@ -335,6 +350,9 @@
                                },
                                function ( PostRevision $revision, Templating 
$templating, User $user, Block $block ) {
                                        return 
$templating->getUrlGenerator()->generateUrl( $block->getWorkflowId(), 'view', 
array() );
+                               },
+                               function ( PostRevision $revision, Templating 
$templating, User $user, Block $block ) {
+                                       return $revision->getModeratedReason();
                                },
                        ),
                        'class' => 'flow-history-censored-topic',
@@ -372,6 +390,9 @@
                                        $data = array( $block->getName() . 
'[postId]' => $revision->getPostId()->getHex() );
                                        return 
$templating->getUrlGenerator()->generateUrl( $block->getWorkflowId(), 'view', 
$data );
                                },
+                               function ( PostRevision $revision, Templating 
$templating, User $user, Block $block ) {
+                                       return $revision->getModeratedReason();
+                               },
                        ),
                        'class' => 'flow-history-restored-post',
                ),
@@ -407,6 +428,9 @@
                                function ( PostRevision $revision, Templating 
$templating, User $user, Block $block ) {
                                        return 
$templating->getUrlGenerator()->generateUrl( $block->getWorkflowId(), 'view', 
array() );
                                },
+                               function ( PostRevision $revision, Templating 
$templating, User $user, Block $block ) {
+                                       return $revision->getModeratedReason();
+                               },
                        ),
                        'class' => 'flow-history-restored-topic',
                ),
diff --git a/includes/Model/AbstractRevision.php 
b/includes/Model/AbstractRevision.php
index 475a432..e776ebe 100644
--- a/includes/Model/AbstractRevision.php
+++ b/includes/Model/AbstractRevision.php
@@ -212,17 +212,17 @@
                                $rev->moderatedByUserId = null;
                                $rev->moderatedByUserText = null;
                                $rev->moderationTimestamp = null;
-                               // This is a bit hacky, but we store the 
restore reason
-                               // in the "moderated reason" field. Hmmph.
-                               $rev->moderatedReason = $reason;
                        } else {
                                $rev->moderatedByUserId = $user->getId();
                                $rev->moderatedByUserText = $user->getName();
                                $rev->moderationTimestamp = $timestamp;
-                               $rev->moderatedReason = $reason;
                        }
                }
 
+               // This is a bit hacky, but we store the restore reason
+               // in the "moderated reason" field. Hmmph.
+               $obj->moderatedReason = $reason;
+
                return $obj;
        }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I8b6c28bbbb67550922d8f15f8ceced11d6e6cec9
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Werdna <[email protected]>
Gerrit-Reviewer: EBernhardson <[email protected]>
Gerrit-Reviewer: Matthias Mullie <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to