Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F4643
tmp
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
•
bzimport
Nov 21 2014, 10:02 PM
2014-11-21 22:02:58 (UTC+0)
Size
2 KB
Referenced Files
None
Subscribers
None
tmp
View Options
Index: ChangesList.php
===================================================================
--- ChangesList.php (revision 38874)
+++ ChangesList.php (working copy)
@@ -240,6 +240,32 @@
}
}
}
+
+ /** Insert a rollback link, if the user has permission */
+ protected function maybeInsertRollbackLink( &$s, &$rc ) {
+ global $wgUser; // We don't have time to check perms properly.
+ if( $wgUser->isAllowed('rollback') && $rc->mAttribs['rc_this_oldid'] != 0) {
+ $title = Title::makeTitle( $rc->mAttribs['rc_namespace'], $rc->mAttribs['rc_title'] );
+ $s .= ' <span class="mw-rollback-link">['.$this->buildRollbackLink( $title, $rc->mAttribs['rc_user_text'] ).']</span>';
+ }
+ }
+
+ /** Build a rollback link, from only the username and prefixed title */
+ public function buildRollbackLink( $title, $edit_user ) {
+ global $wgRequest, $wgUser;
+
+ $query = array(
+ 'action' => 'rollback',
+ 'from' => $edit_user
+ );
+ if( $wgRequest->getBool( 'bot' ) ) {
+ $query['bot'] = '1';
+ }
+ $query['token'] = $wgUser->editToken( array( $title->getPrefixedText(),
+ $edit_user ) );
+ return $this->skin->link( $title, wfMsgHtml( 'rollbacklink' ), array(),
+ $query, array( 'known', 'noclasses' ) );
+ }
/**
* Check whether to enable recent changes patrol features
@@ -371,6 +397,8 @@
if($rc->numberofWatchingusers > 0) {
$s .= ' ' . wfMsg('number_of_watching_users_RCview', $wgContLang->formatNum($rc->numberofWatchingusers));
}
+
+ $this->maybeInsertRollbackLink( $s, $rc );
$s .= "</li>\n";
Index: specials/SpecialContributions.php
===================================================================
--- specials/SpecialContributions.php (revision 38874)
+++ specials/SpecialContributions.php (working copy)
@@ -115,8 +115,8 @@
$difftext .= $this->messages['newarticle'];
}
- if( !$page->getUserPermissionsErrors( 'rollback', $wgUser )
- && !$page->getUserPermissionsErrors( 'edit', $wgUser ) ) {
+ if( !count($page->getUserPermissionsErrors( 'rollback', $wgUser ) )
+ && !count($page->getUserPermissionsErrors( 'edit', $wgUser ) ) ) {
$topmarktext .= ' '.$sk->generateRollback( $rev );
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4208
Default Alt Text
tmp (2 KB)
Attached To
Mode
T15589: Request for a rollback button at Special:RecentChangesLinked
Attached
Detach File
Event Timeline
Log In to Comment