Sbisson has uploaded a new change for review.

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

Change subject: [WIP] Add 'Log' link to user-rights notification
......................................................................

[WIP] Add 'Log' link to user-rights notification

Bug: T127249
Change-Id: I0ee20fefa2241d2858e6473bb709dce9519b82d4
---
M i18n/en.json
M i18n/qqq.json
M includes/formatters/UserRightsPresentationModel.php
3 files changed, 19 insertions(+), 1 deletion(-)


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

diff --git a/i18n/en.json b/i18n/en.json
index c2f9074..b9a460d 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -25,6 +25,7 @@
        "echo-pref-beta-feature-cross-wiki-message": "Enhanced notifications",
        "echo-pref-beta-feature-cross-wiki-description": "View and organize 
notifications more easily. Includes cross-wiki notifications, which lets you 
see messages from other wikis.",
        "echo-learn-more": "Learn more",
+       "echo-log": "Log",
        "echo-new-messages": "You have new messages",
        "echo-category-title-edit-user-talk": "Talk page 
{{PLURAL:$1|message|messages}}",
        "echo-category-title-article-linked": "Page {{PLURAL:$1|link|links}}",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 2685150..3bdc8d7 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -46,6 +46,7 @@
        "echo-pref-beta-feature-cross-wiki-message": "Label for the cross-wiki 
notifications Beta Feature.",
        "echo-pref-beta-feature-cross-wiki-description": "Description for the 
cross-wiki notifications Beta Feature, describing the feature that will be 
enabled.",
        "echo-learn-more": "Text for link to more information about a 
topic.\n{{Identical|Learn more}}",
+       "echo-log": "Text for link to go to Special:Log",
        "echo-new-messages": "Message to let the user know that they have new 
talk page messages, displayed in the personal menu (top-right corner on Vector 
and Monobook).\n\nKeep this message short. It '''should not''' end in a full 
stop.",
        "echo-category-title-edit-user-talk": "This is a short title for 
notification category.\n\nUsed in a list of options under the heading 
{{msg-mw|Prefs-echosubscriptions}} in Special:Preferences. As far as I can see 
this always needs to be a plural for an unspecified number.\n\nIt used to be 
used as <code>$1</code> in {{msg-mw|Echo-dismiss-message}}, but this message is 
no longer used, apparently.\n\nParameters:\n* $1 - number of messages, for 
PLURAL support\n{{Related|Echo-category-title}}",
        "echo-category-title-article-linked": "This is a short title for 
notification category.\n\nUsed in a list of options under the heading 
{{msg-mw|Prefs-echosubscriptions}} in Special:Preferences. As far as I can see 
this always needs to be a plural for an unspecified number.\n\nIt used to be 
used as <code>$1</code> in {{msg-mw|Echo-dismiss-message}}, but this message is 
no longer used, apparently.\n\nParameters:\n* $1 - number of messages, for 
PLURAL support\n{{Related|Echo-category-title}}",
diff --git a/includes/formatters/UserRightsPresentationModel.php 
b/includes/formatters/UserRightsPresentationModel.php
index 3782300..08ac8f2 100644
--- a/includes/formatters/UserRightsPresentationModel.php
+++ b/includes/formatters/UserRightsPresentationModel.php
@@ -59,6 +59,22 @@
        }
 
        public function getSecondaryLinks() {
-               return array( $this->getAgentLink() );
+               return array( $this->getAgentLink(), $this->getLogLink() );
+       }
+
+       private function getLogLink() {
+               $affectedUserPage = User::newFromId( 
$this->event->getExtraParam( 'user' ) )->getUserPage();
+               $query = array(
+                       'type' => 'rights',
+                       'page' => $affectedUserPage->getPrefixedText(),
+                       'user' => $this->event->getAgent()->getName(),
+               );
+               return array(
+                       'label' => $this->msg( 'echo-log' )->text(),
+                       'url' => SpecialPage::getTitleFor( 'Log' )->getFullURL( 
$query ),
+                       'description' => '',
+                       'icon' => false,
+                       'prioritized' => true,
+               );
        }
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0ee20fefa2241d2858e6473bb709dce9519b82d4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Sbisson <sbis...@wikimedia.org>

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

Reply via email to