mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-12 01:10:07 +00:00
Merge "Presentation model for reverted"
This commit is contained in:
commit
904e1e5a8c
3
Echo.php
3
Echo.php
|
@ -328,6 +328,7 @@ $wgEchoNotifications = array(
|
|||
'immediate' => true,
|
||||
),
|
||||
'reverted' => array(
|
||||
'presentation-model' => 'EchoRevertedPresentationModel',
|
||||
'user-locators' => array(
|
||||
array( 'EchoUserLocator::locateFromEventExtra', array( 'reverted-user-id' ) ),
|
||||
),
|
||||
|
@ -338,8 +339,6 @@ $wgEchoNotifications = array(
|
|||
'formatter-class' => 'EchoEditFormatter',
|
||||
'title-message' => 'notification-reverted2',
|
||||
'title-params' => array( 'agent', 'title', 'difflink', 'number', 'userpage-contributions' ),
|
||||
'flyout-message' => 'notification-reverted-flyout2',
|
||||
'flyout-params' => array( 'agent', 'title', 'difflink', 'number' ),
|
||||
'email-subject-message' => 'notification-reverted-email-subject2',
|
||||
'email-subject-params' => array( 'agent', 'title', 'number' ),
|
||||
'email-body-batch-message' => 'notification-reverted-email-batch-body2',
|
||||
|
|
|
@ -74,6 +74,7 @@ $wgAutoloadClasses += array(
|
|||
'EchoNotifier' => __DIR__ . '/Notifier.php',
|
||||
'EchoOnWikiList' => __DIR__ . '/includes/ContainmentSet.php',
|
||||
'EchoPageLinkFormatter' => __DIR__ . '/includes/formatters/PageLinkFormatter.php',
|
||||
'EchoRevertedPresentationModel' => __DIR__ . '/includes/formatters/RevertedPresentationModel.php',
|
||||
'EchoRevisionLocalCache' => __DIR__ . '/includes/cache/RevisionLocalCache.php',
|
||||
'EchoRowUpdateGenerator' => __DIR__ . '/includes/BatchRowUpdate.php',
|
||||
'EchoSeenTime' => __DIR__ . '/includes/SeenTime.php',
|
||||
|
|
|
@ -80,7 +80,7 @@
|
|||
"notification-welcome-link": "",
|
||||
"notification-welcome-linktext": "Welcome",
|
||||
"notification-reverted2": "Your {{PLURAL:$4|edit on [[:$2]] has|edits on [[:$2]] have}} been {{GENDER:$1|reverted}} by [[$5|$1]]. $3",
|
||||
"notification-reverted-flyout2": "Your {{PLURAL:$4|edit on $2 has|edits on $2 have}} been {{GENDER:$1|reverted}} by $1. $3",
|
||||
"notification-header-reverted": "Your {{PLURAL:$4|edit on $3 has|edits on $3 have}} been {{GENDER:$2|reverted}} by $1.",
|
||||
"notification-emailuser": "[[User:$1|$1]] {{GENDER:$1|sent}} you an email.",
|
||||
"notification-header-emailuser": "$1 {{GENDER:$2|sent}} you an email",
|
||||
"notification-edit-talk-page-email-subject2": "$1 {{GENDER:$1|left}} you a message on {{SITENAME}}",
|
||||
|
|
|
@ -101,7 +101,7 @@
|
|||
"notification-welcome-link": "{{notranslate}}",
|
||||
"notification-welcome-linktext": "Link text for link to the wiki's welcome or introduction page.\n{{Identical|Welcome}}",
|
||||
"notification-reverted2": "Format for displaying notifications of a user's edit being reverted. Parameters:\n* $1 - the username of the person who reverted, plain text. Can be used for GENDER.\n* $2 - the page that was reverted, formatted\n* $3 - a diff link which is labeled {{msg-mw|Showdiff}}\n* $4 - the number of edits that were reverted. NOTE: This will only be set to 1 or 2, with 2 actually meaning 'an unknown number greater than 0'.\n* $5 - Page for reverting user.\nUser page if logged in, or user's contributions page if logged out.\n{{Related|Notification-reverted}}",
|
||||
"notification-reverted-flyout2": "Flyout-specific format for displaying notifications of a user's edit being reverted.\n\nParameters:\n* $1 - the username of the person who reverted, plain text. Can be used for GENDER.\n* $2 - the page that was reverted, formatted\n* $3 - a diff link which is labeled {{msg-mw|Showdiff}}\n* $4 - the number of edits that were reverted. NOTE: This will only be set to 1 or 2, with 2 actually meaning \"an unknown number greater than 0\".\n{{Related|Notification-reverted}}",
|
||||
"notification-header-reverted": "Flyout-specific format for displaying notifications of a user's edit being reverted.\n\nParameters:\n* $1 - the formatted username of the person who reverted.\n* $2 - the username for GENDER\n* $3 - the page that was reverted, formatted\n* $4 - the number of edits that were reverted. NOTE: This will only be set to 1 or 2, with 2 actually meaning \"an unknown number greater than 0\".\n{{Related|Notification-reverted}}",
|
||||
"notification-emailuser": "Format for displaying notifications of a user has sent an email to another user. Parameters:\n* $1 - the username of the person the email, plain text. Can be used for GENDER.",
|
||||
"notification-header-emailuser": "Flyout-specific format for displaying notifications of user has sent an email to another user.\n\nParameters:\n* $1 - the formatted username of the person who sent the email.\n* $2 - the username for GENDER.",
|
||||
"notification-edit-talk-page-email-subject2": "Email subject. Parameters:\n* $1 - a username which can be used for gender support",
|
||||
|
|
44
includes/formatters/RevertedPresentationModel.php
Normal file
44
includes/formatters/RevertedPresentationModel.php
Normal file
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
class EchoRevertedPresentationModel extends EchoEventPresentationModel {
|
||||
|
||||
public function getIconType() {
|
||||
return 'revert';
|
||||
}
|
||||
|
||||
public function canRender() {
|
||||
return (bool)$this->event->getTitle();
|
||||
}
|
||||
|
||||
public function getHeaderMessage() {
|
||||
$msg = parent::getHeaderMessage();
|
||||
$msg->params( $this->event->getTitle()->getPrefixedText() );
|
||||
$msg->params( $this->getNumberOfEdits() );
|
||||
return $msg;
|
||||
}
|
||||
|
||||
public function getPrimaryLink() {
|
||||
$url = $this->event->getTitle()->getLocalURL( array(
|
||||
'oldid' => 'prev',
|
||||
'diff' => $this->event->getExtraParam( 'revid' )
|
||||
) );
|
||||
return array(
|
||||
$url, $this->msg( 'notification-link-text-view-changes' )->text()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return a number that represents if one or multiple edits
|
||||
* have been reverted for formatting purposes.
|
||||
* @return int
|
||||
*/
|
||||
private function getNumberOfEdits() {
|
||||
$method = $this->event->getExtraParam( 'method' );
|
||||
if ( $method && $method === 'rollback' ) {
|
||||
return 2;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue