From: Matěj Suchánek Date: Sun, 7 May 2017 19:48:53 +0000 (+0200) Subject: Ensure whether user can rollback page in ChangesList X-Git-Tag: 1.34.0-rc.0~4838^2 X-Git-Url: https://git.heureux-cyclage.org/?a=commitdiff_plain;h=85b8aed11b7297c192d88909482c943d3a3c784a;p=lhc%2Fweb%2Fwiklou.git Ensure whether user can rollback page in ChangesList This is already done in Special:Contributions. Bug: T50731 Change-Id: I2a608f32c90ff0c06c92937b5edf0ee000ca8aba --- diff --git a/includes/changes/ChangesList.php b/includes/changes/ChangesList.php index ac029a2bb3..a4d418b52e 100644 --- a/includes/changes/ChangesList.php +++ b/includes/changes/ChangesList.php @@ -625,7 +625,8 @@ class ChangesList extends ContextSource { } } - /** Inserts a rollback link + /** + * Insert a rollback link * * @param string &$s * @param RecentChange &$rc @@ -634,15 +635,14 @@ class ChangesList extends ContextSource { if ( $rc->mAttribs['rc_type'] == RC_EDIT && $rc->mAttribs['rc_this_oldid'] && $rc->mAttribs['rc_cur_id'] + && $rc->getAttribute( 'page_latest' ) == $rc->mAttribs['rc_this_oldid'] ) { - $page = $rc->getTitle(); - /** Check for rollback and edit permissions, disallow special pages, and only + $title = $rc->getTitle(); + /** Check for rollback permissions, disallow special pages, and only * show a link on the top-most revision */ - if ( $this->getUser()->isAllowed( 'rollback' ) - && $rc->mAttribs['page_latest'] == $rc->mAttribs['rc_this_oldid'] - ) { + if ( $title->quickUserCan( 'rollback', $this->getUser() ) ) { $rev = new Revision( [ - 'title' => $page, + 'title' => $title, 'id' => $rc->mAttribs['rc_this_oldid'], 'user' => $rc->mAttribs['rc_user'], 'user_text' => $rc->mAttribs['rc_user_text'],