Kmuthu has uploaded a new change for review.

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

Change subject: UsersLinkedToSpecificGroup
......................................................................

UsersLinkedToSpecificGroup

Users routed to the group they are added/removed.
Bug: T55860

Change-Id: Iff5f4d38ca2cc479c269ef736a7fd957959a03dc
---
M includes/formatters/UserRightsPresentationModel.php
1 file changed, 21 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Echo 
refs/changes/36/312436/1

diff --git a/includes/formatters/UserRightsPresentationModel.php 
b/includes/formatters/UserRightsPresentationModel.php
index 106b829..c877da1 100644
--- a/includes/formatters/UserRightsPresentationModel.php
+++ b/includes/formatters/UserRightsPresentationModel.php
@@ -58,11 +58,27 @@
        }
 
        public function getPrimaryLink() {
-               return array(
-                       'url' => SpecialPage::getTitleFor( 'Listgrouprights' 
)->getLocalURL(),
-                       'label' => $this->msg( 'echo-learn-more' )->text()
-               );
-       }
+               $addedGroup = array_values( $this->event->getExtraParam( 'add', 
array() ) );
+               $removedGroup =  array_values( $this->event->getExtraParam( 
'remove', array() ) );
+               if( count( $addedGroup ) >= 1 && empty( $removedGroup ) ){
+                       $addedGroup_firstValue = array_values( 
$this->event->getExtraParam( 'add', array() ) )[0];
+                       return array(
+                               'url' => SpecialPage::getTitleFor( 
'Listgrouprights', false,    $addedGroup_firstValue )->getFullURL(),
+                               'label' => $this->msg( 'echo-learn-more' 
)->text()
+                       );
+               } elseif ( empty( $addedGroup ) && count( $removedGroup ) >= 1) 
{
+                       $removedGroup_firstValue = array_values( 
$this->event->getExtraParam( 'remove', array() ) )[0];
+                       return array(
+                               'url' => SpecialPage::getTitleFor( 
'Listgrouprights', false, $removedGroup_firstValue )->getFullURL(),
+                               'label' => $this->msg( 'echo-learn-more' 
)->text()
+                       );
+               } else {
+                       return array(
+                               'url' => SpecialPage::getTitleFor( 
'Listgrouprights' )->getFullURL(),
+                               'label' => $this->msg( 'echo-learn-more' 
)->text()
+                       );
+               }
+       }
 
        public function getSecondaryLinks() {
                return array( $this->getAgentLink(), $this->getLogLink() );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iff5f4d38ca2cc479c269ef736a7fd957959a03dc
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Kmuthu <kmu...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to