Werdna has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/96417


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, 36 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow 
refs/changes/17/96417/1

diff --git a/Flow.i18n.php b/Flow.i18n.php
index 508414e..3fd0aa8 100644
--- a/Flow.i18n.php
+++ b/Flow.i18n.php
@@ -101,15 +101,15 @@
 
        'flow-rev-message-create-header' => "[[User:$1|$1]] 
{{GENDER:$1|created}} the board header.",
        'flow-rev-message-edit-header' => "[[User:$1|$1]] {{GENDER:$1|edited}} 
the board header.",
-       'flow-rev-message-hid-post' => '[[User:$1|$1]] {{GENDER:$1|hid}} a [$3 
comment].',
-       'flow-rev-message-deleted-post' => '[[User:$1|$1]] 
{{GENDER:$1|deleted}} a [$3 comment].',
-       'flow-rev-message-censored-post' => '[[User:$1|$1]] 
{{GENDER:$1|suppressed}} a [$3 comment].',
-       'flow-rev-message-restored-post' => '[[User:$1|$1]] 
{{GENDER:$1|restored}} a [$3 comment].',
+       'flow-rev-message-hid-post' => '[[User:$1|$1]] {{GENDER:$1|hid}} a [$3 
comment] (\'\' $4 \'\').',
+       'flow-rev-message-deleted-post' => '[[User:$1|$1]] 
{{GENDER:$1|deleted}} a [$3 comment] (\'\' $4 \'\').',
+       'flow-rev-message-censored-post' => '[[User:$1|$1]] 
{{GENDER:$1|suppressed}} a [$3 comment] (\'\' $4 \'\').',
+       'flow-rev-message-restored-post' => '[[User:$1|$1]] 
{{GENDER:$1|restored}} a [$3 comment] (\'\' $4 \'\').',
 
-       'flow-rev-message-hid-topic' => '[[User:$1|$1]] {{GENDER:$1|hid}} the 
[$3 topic].',
-       'flow-rev-message-deleted-topic' => '[[User:$1|$1]] 
{{GENDER:$1|deleted}} the [$3 topic].',
-       'flow-rev-message-censored-topic' => '[[User:$1|$1]] 
{{GENDER:$1|suppressed}} the [$3 topic].',
-       'flow-rev-message-restored-topic' => '[[User:$1|$1]] 
{{GENDER:$1|restored}} the [$3 topic].',
+       'flow-rev-message-hid-topic' => '[[User:$1|$1]] {{GENDER:$1|hid}} the 
[$3 topic] (\'\' $4 \'\').',
+       'flow-rev-message-deleted-topic' => '[[User:$1|$1]] 
{{GENDER:$1|deleted}} the [$3 topic] (\'\' $4 \'\').',
+       'flow-rev-message-censored-topic' => '[[User:$1|$1]] 
{{GENDER:$1|suppressed}} the [$3 topic] (\'\' $4 \'\').',
+       'flow-rev-message-restored-topic' => '[[User:$1|$1]] 
{{GENDER:$1|restored}} the [$3 topic] (\'\' $4 \'\').',
 
        'flow-board-history' => '"$1" history',
        'flow-topic-history' => '"$1" topic history',
diff --git a/FlowActions.php b/FlowActions.php
index c527a67..3a8a049 100644
--- a/FlowActions.php
+++ b/FlowActions.php
@@ -172,6 +172,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',
                ),
@@ -195,6 +198,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',
@@ -222,6 +228,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',
                ),
@@ -246,6 +255,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',
@@ -274,6 +286,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',
                ),
@@ -299,6 +314,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',
@@ -333,6 +351,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',
                ),
@@ -365,6 +386,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: newchange
Gerrit-Change-Id: I8b6c28bbbb67550922d8f15f8ceced11d6e6cec9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Werdna <[email protected]>

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

Reply via email to