Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F5163
hidebots.patch
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:20 PM
2014-11-21 22:20:53 (UTC+0)
Size
2 KB
Referenced Files
None
Subscribers
None
hidebots.patch
View Options
Index: skins/common/history.js
===================================================================
--- skins/common/history.js (revision 49675)
+++ skins/common/history.js (working copy)
@@ -121,4 +121,23 @@
}
}
+// In case of hidebots=1 and no non-bot edits there
+function singlehistrowinit() {
+ var pagehistory = document.getElementById( 'pagehistory' );
+ if ( !pagehistory ) return;
+ var lis = pagehistory.getElementsByTagName( 'li' );
+ if ( lis.length == 1 ) {
+ lis[0].setAttribute( 'class', '' );
+ var radios = historyRadios( lis[0] );
+ if ( radios.length < 2 ) return;
+ radios[0].style.display = 'none';
+ radios[1].style.display = 'none';
+ var historysubmit = getElementsByClassName( document, 'input', 'historysubmit' );
+ if ( historysubmit.length < 2 ) return;
+ historysubmit[0].style.display = 'none';
+ historysubmit[1].style.display = 'none';
+ }
+}
+
hookEvent("load", histrowinit);
+hookEvent("load", singlehistrowinit);
Index: includes/PageHistory.php
===================================================================
--- includes/PageHistory.php (revision 49675)
+++ includes/PageHistory.php (working copy)
@@ -23,7 +23,8 @@
var $lastdate;
var $linesonpage;
var $mLatestId = null;
-
+ var $hideBots = false;
+
private $mOldIdChecked = 0;
/**
@@ -33,11 +34,12 @@
* @returns nothing
*/
function __construct( $article ) {
- global $wgUser;
+ global $wgUser, $wgRequest;
$this->mArticle =& $article;
$this->mTitle =& $article->mTitle;
$this->mSkin = $wgUser->getSkin();
$this->preCacheMessages();
+ $this->hideBots = intval( $wgRequest->data['hidebots'] ) == 1 ? true : false;
}
function getArticle() {
@@ -614,6 +616,16 @@
function formatRow( $row ) {
if( $this->mLastRow ) {
+ if ( $this->mPageHistory->hideBots ) {
+ $user = User::newFromId( intval( $this->mLastRow->rev_user ) );
+ if ( is_object( $user ) ) {
+ $user->loadGroups();
+ if ( @in_array( 'bot', $user->mGroups ) ) {
+ $this->mLastRow = $row;
+ return '';
+ }
+ }
+ }
$latest = $this->mCounter == 1 && $this->mIsFirst;
$firstInList = $this->mCounter == 1;
$s = $this->mPageHistory->historyLine( $this->mLastRow, $row, $this->mCounter++,
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4725
Default Alt Text
hidebots.patch (2 KB)
Attached To
Mode
T18228: filter history of edits on bots (hidebots=1)
Attached
Detach File
Event Timeline
Log In to Comment