Skip to content
This repository has been archived by the owner on Jun 30, 2024. It is now read-only.

Commit

Permalink
Replace deprecated onHistoryRevisionTools hook
Browse files Browse the repository at this point in the history
  • Loading branch information
lens0021 committed Aug 12, 2020
1 parent 9b128ae commit 7883414
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion extension.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
"ResourceLoaderGetConfigVars": "SanctionsHooks::onResourceLoaderGetConfigVars",
"UserToolLinksEdit": "SanctionsHooks::onUserToolLinksEdit",
"DiffTools": "SanctionsHooks::onDiffTools",
"HistoryRevisionTools": "SanctionsHooks::onHistoryRevisionTools",
"HistoryTools": "SanctionsHooks::onHistoryTools",
"SidebarBeforeOutput": "SanctionsHooks::onSidebarBeforeOutput",
"ContributionsToolLinks": "SanctionsHooks::onContributionsToolLinks",
"FlowAddModules": "SanctionsHooks::onFlowAddModules"
Expand Down
16 changes: 9 additions & 7 deletions includes/SanctionsHooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,17 +230,19 @@ public static function onDiffTools( $newRevRecord, &$links, $oldRevRecord, $user
}

/**
* @param Revision $rev Revision object
* @param array &$links Array of HTML links
* @return bool
* @param RevisionRecord $revRecord
* @param string[] &$links Array of HTML links
* @param RevisionRecord|null $prevRevRecord RevisionRecord object, next in line
* in page history, or null
* @param UserIdentity $userIdentity Current user
* @return bool|void True or no return value to continue or false to abort
*/
public static function onHistoryRevisionTools( $rev, &$links ) {
$user = RequestContext::getMain()->getUser();
if ( $user == null || !SanctionsUtils::hasVoteRight( $user ) ) {
public static function onHistoryTools( $revRecord, &$links, $prevRevRecord, $userIdentity ) {
if ( $userIdentity == null || !SanctionsUtils::hasVoteRight( $userIdentity ) ) {
return true;
}

$titleText = $rev->getUserText() . '/' . $rev->getId();
$titleText = $revRecord->getUser()->getName() . '/' . $revRecord->getId();
$links[] = Linker::link(
SpecialPage::getTitleFor( 'Sanctions', $titleText ),
wfMessage( 'sanctions-link-on-history' )->text()
Expand Down

0 comments on commit 7883414

Please sign in to comment.