mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-12-01 02:46:46 +00:00
7d2a15d3bc
* edit-user-talk * mention * user-rights * emailuser Bug: T121735 Change-Id: I72e382b9ff9d19c6acc0df507fdff65732b66450
59 lines
1.4 KiB
PHP
59 lines
1.4 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Formatter for 'user-rights' notifications
|
|
*/
|
|
class EchoUserRightsPresentationModel extends EchoEventPresentationModel {
|
|
|
|
public function getIconType() {
|
|
return 'user-rights';
|
|
}
|
|
|
|
public function getHeaderMessage() {
|
|
$msg = parent::getHeaderMessage();
|
|
// @todo fix lego message
|
|
$msg->params( $this->getChangedGroups() );
|
|
|
|
return $msg;
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
private function getChangedGroups() {
|
|
$list = array();
|
|
$extra = $this->event->getExtra();
|
|
foreach ( array( 'add', 'remove' ) as $action ) {
|
|
if ( isset( $extra[$action] ) && $extra[$action] ) {
|
|
|
|
// Get the localized group names, bug 55338
|
|
$groups = array();
|
|
foreach ( $extra[$action] as $group ) {
|
|
$msg = $this->msg( 'group-' . $group );
|
|
$groups[] = $msg->isBlank() ? $group : $msg->text();
|
|
}
|
|
|
|
// Messages that can be used here:
|
|
// * notification-user-rights-add
|
|
// * notification-user-rights-remove
|
|
$list[] = $this->msg( 'notification-user-rights-' . $action )
|
|
->params( $this->language->commaList( $groups ), count( $groups ) )
|
|
->text();
|
|
}
|
|
}
|
|
|
|
return $this->language->semicolonList( $list );
|
|
}
|
|
|
|
public function getPrimaryLink() {
|
|
return array(
|
|
'url' => SpecialPage::getTitleFor( 'Listgrouprights' )->getLocalURL(),
|
|
'label' => $this->msg( 'echo-learn-more' )->text()
|
|
);
|
|
}
|
|
|
|
public function getSecondaryLinks() {
|
|
return array( $this->getAgentLink() );
|
|
}
|
|
}
|