Use HistoryPageToolLinks hook to add a log link to history pages

Add an AbuseFilter log link to the subtitle of history pages.

Bug: T28934
Co-authored-by: Matěj Suchánek
Depends-On: I2e0e9e92d3fc303135b0eb9acf06b5fd120178a5
Depends-On: I58a3039b3755648bb0c8aaf87db48ace96ce9344
Change-Id: Ib89c48f2b8f3121ead184844844acee436e2fdd6
This commit is contained in:
tinajohnson.1234 2014-03-25 21:27:01 +05:30 committed by Matěj Suchánek
parent eee65af0ac
commit c9003fe1fa
4 changed files with 27 additions and 0 deletions

View file

@ -225,6 +225,7 @@
"ChangeTagsListActive": "AbuseFilterHooks::onChangeTagsListActive",
"LoadExtensionSchemaUpdates": "AbuseFilterHooks::onLoadExtensionSchemaUpdates",
"ContributionsToolLinks": "AbuseFilterHooks::onContributionsToolLinks",
"HistoryPageToolLinks": "AbuseFilterHooks::onHistoryPageToolLinks",
"UploadVerifyUpload": "AbuseFilterHooks::onUploadVerifyUpload",
"UploadStashFile": "AbuseFilterHooks::onUploadStashFile",
"MakeGlobalVariablesScript": "AbuseFilterHooks::onMakeGlobalVariablesScript",

View file

@ -79,6 +79,8 @@
"abusefilter-log-details-diff": "Changes made in edit",
"abusefilter-log-linkoncontribs": "abuse log",
"abusefilter-log-linkoncontribs-text": "Abuse log for {{GENDER:$1|this user}}",
"abusefilter-log-linkonhistory": "view abuse log",
"abusefilter-log-linkonhistory-text": "View abuse log for this page",
"abusefilter-log-hidden": "(entry hidden)",
"abusefilter-log-hidden-implicit": "(hidden because revision has been deleted)",
"abusefilter-log-cannot-see-details": "You do not have permission to see details of this entry.",

View file

@ -112,6 +112,8 @@
"abusefilter-log-details-diff": "Header for differences between two edits in log details.",
"abusefilter-log-linkoncontribs": "Link text added on [[Special:Contributions]] and other relevant special pages.\n{{Identical|Abuse log}}",
"abusefilter-log-linkoncontribs-text": "Title for link added on [[Special:Contributions]] and other relevant special pages. Parameters:\n* $1 is the target user name used for GENDER.",
"abusefilter-log-linkonhistory": "Link text added to the subtitle of the revision history page.",
"abusefilter-log-linkonhistory-text": "Title for link added to the subtitle of the revision history page.",
"abusefilter-log-hidden": "Text for a hidden log entry.",
"abusefilter-log-hidden-implicit": "Explanatory text to be shown beside an abuse filter log entry if it cannot be viewed due to its corresponding revision being hidden",
"abusefilter-log-cannot-see-details": "Message shown instead of log row details for users without permissions to see them.",

View file

@ -1,5 +1,6 @@
<?php
use MediaWiki\Linker\LinkRenderer;
use MediaWiki\MediaWikiServices;
use Wikimedia\Rdbms\Database;
@ -637,6 +638,27 @@ class AbuseFilterHooks {
}
}
/**
* @param IContextSource $context
* @param LinkRenderer $linkRenderer
* @param string[] &$links
*/
public static function onHistoryPageToolLinks(
IContextSource $context,
LinkRenderer $linkRenderer,
array &$links
) {
$user = $context->getUser();
if ( $user->isAllowed( 'abusefilter-log' ) ) {
$links[] = $linkRenderer->makeLink(
SpecialPage::getTitleFor( 'AbuseLog' ),
$context->msg( 'abusefilter-log-linkonhistory' )->text(),
[ 'title' => $context->msg( 'abusefilter-log-linkonhistory-text' )->text() ],
[ 'wpSearchTitle' => $context->getTitle()->getPrefixedText() ]
);
}
}
/**
* Filter an upload.
*