Alex Monk has uploaded a new change for review.
https://gerrit.wikimedia.org/r/49790
Change subject: (bug 36098) Add revert link to thread move logs and success page
......................................................................
(bug 36098) Add revert link to thread move logs and success page
Change-Id: I85b99b17ed1505468ea554527c7d1dbb39b3f78f
---
M classes/LogFormatter.php
M i18n/Lqt.i18n.php
M pages/SpecialMoveThread.php
3 files changed, 37 insertions(+), 18 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/LiquidThreads
refs/changes/90/49790/1
diff --git a/classes/LogFormatter.php b/classes/LogFormatter.php
index 6f394d2..01b987b 100644
--- a/classes/LogFormatter.php
+++ b/classes/LogFormatter.php
@@ -3,7 +3,9 @@
// Contains formatter functions for all log entry types.
class LqtLogFormatter {
static function formatLogEntry( $type, $action, $title, $sk,
$parameters ) {
- switch( $action ) {
+ $msg = "lqt-log-action-$action";
+
+ switch ( $action ) {
case 'merge':
if ( $parameters[0] ) {
$msg = 'lqt-log-action-merge-across';
@@ -11,22 +13,23 @@
$msg = 'lqt-log-action-merge-down';
}
break;
- default:
- $msg = "lqt-log-action-$action";
+ case 'move':
+ $parameters[] = Message::rawParam( Linker::link(
+ SpecialPage::getTitleFor( 'MoveThread',
$title ),
+ wfMessage( 'revertmove' )->text(),
+ array(),
+ array( 'dest' => $parameters[0] )
+ ) );
break;
}
array_unshift( $parameters, $title->getPrefixedText() );
$html = wfMessage( $msg, $parameters );
- $forIRC = $sk === null;
- if ( $forIRC ) {
- $html = $html->inContentLanguage()->parse();
- $html = StringUtils::delimiterReplace( '<', '>', '',
$html );
+ if ( $sk === null ) {
+ return StringUtils::delimiterReplace( '<', '>', '',
$html->inContentLanguage()->parse() );
} else {
- $html = $html->parse();
+ return $html->parse();
}
-
- return $html;
}
}
diff --git a/i18n/Lqt.i18n.php b/i18n/Lqt.i18n.php
index ab09559..c3d1cf0 100644
--- a/i18n/Lqt.i18n.php
+++ b/i18n/Lqt.i18n.php
@@ -103,7 +103,7 @@
'lqt_move_thread_bad_destination' => 'The destination page is not a
discussion page.',
'lqt_move_samedestination' => 'The thread is already on this page!',
'lqt_move_noreason' => 'No reason given.',
- 'lqt_move_success' => 'The thread was moved to $1.',
+ 'lqt_move_success' => 'The thread was moved to $1: $2.',
'lqt_talkpage_autocreate_summary' => 'Talk page autocreated when first
thread was posted',
'lqt_header_warning_before_big' => '',
'lqt_header_warning_big' => 'You are editing a $1.',
@@ -186,7 +186,7 @@
// Logging
'lqt-log-name' => 'Threaded discussion log',
'lqt-log-header' => 'This log details actions taken on discussion
threads.',
- 'lqt-log-action-move' => 'moved [[$1]] from [[$2]] to [[$3]]',
+ 'lqt-log-action-move' => 'moved [[$1]] from [[$2]] to [[$3]] ($4)',
'lqt-log-action-split' => 'split [[$1]] from under [[$3]], with the new
subject "$2"',
'lqt-log-action-merge-across' => 'moved [[$1]] from under [[$2]] to
under [[$3]]',
'lqt-log-action-merge-down' => 'merged [[$1]] to underneath [[$3]]',
@@ -531,7 +531,7 @@
'right-lqt-merge' => '{{doc-right|lqt-merge}}',
'right-lqt-react' => '{{doc-right|lqt-react}}',
'lqt-log-name' => '{{doc-logpage}}',
- 'lqt-log-action-move' => 'Parameteres:
+ 'lqt-log-action-move' => 'Parameters:
* $1 is the link text to the topic
* $2 is the link text to the source page the topic was moved from
* $3 is the link text to the target page the topic was moved to',
diff --git a/pages/SpecialMoveThread.php b/pages/SpecialMoveThread.php
index 6607ead..38aab4c 100644
--- a/pages/SpecialMoveThread.php
+++ b/pages/SpecialMoveThread.php
@@ -9,17 +9,25 @@
}
function getFormFields() {
+ $destAdditions = array();
+ $reasonAdditions = array();
+ if ( $this->getRequest()->getCheck( 'dest' ) ) {
+ $destAdditions['default'] =
$this->getRequest()->getText( 'dest' );
+ $reasonAdditions['autofocus'] = true;
+ } else {
+ $destAdditions['autofocus'] = true;
+ }
+
return array(
'dest-title' => array(
'label-message' => 'lqt_move_destinationtitle',
'type' => 'text',
'validation-callback' => array( $this,
'validateTarget' ),
- 'autofocus' => true,
- ),
+ ) + $destAdditions,
'reason' => array(
'label-message' => 'movereason',
'type' => 'text',
- )
+ ) + $reasonAdditions,
);
}
@@ -88,6 +96,7 @@
function trySubmit( $data ) {
// Load data
$tmp = $data['dest-title'];
+ $oldtitle = $this->mThread->getTitle();
$newtitle = Title::newFromText( $tmp );
$reason = $data['reason'];
@@ -99,8 +108,15 @@
// @todo No status code from this method.
$this->mThread->moveToPage( $newtitle, $reason, true );
- $this->getOutput()->addHTML( $this->msg( 'lqt_move_success' )
- ->rawParams( Linker::link( $newtitle )
)->parseAsBlock() );
+ $this->getOutput()->addHTML( $this->msg( 'lqt_move_success'
)->rawParams(
+ Linker::link( $newtitle ),
+ Linker::link(
+ SpecialPage::getTitleFor( 'MoveThread',
$this->mThread->root()->getTitle() ),
+ wfMessage( 'revertmove' )->text(),
+ array(),
+ array( 'dest' => $oldtitle )
+ )
+ )->parseAsBlock() );
return true;
}
--
To view, visit https://gerrit.wikimedia.org/r/49790
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I85b99b17ed1505468ea554527c7d1dbb39b3f78f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/LiquidThreads
Gerrit-Branch: master
Gerrit-Owner: Alex Monk <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits