Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F4124
ApiFeedWatchlist.php.patch
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Authored By
•
bzimport
Nov 21 2014, 9:51 PM
2014-11-21 21:51:36 (UTC+0)
Size
2 KB
Referenced Files
None
Subscribers
None
ApiFeedWatchlist.php.patch
View Options
Index: includes/api/ApiFeedWatchlist.php
===================================================================
--- includes/api/ApiFeedWatchlist.php (revision 75585)
+++ includes/api/ApiFeedWatchlist.php (working copy)
@@ -49,6 +49,8 @@
return new ApiFormatFeedWrapper( $this->getMain() );
}
+ private $useDiffs = false;
+
/**
* Make a nested call to the API to request watchlist items in the last $hours.
* Wrap the result as an RSS/Atom feed.
@@ -81,6 +83,12 @@
$fauxReqArr['wltoken'] = $params['wltoken'];
}
+ // Support linking to diffs instead of article
+ if ( !is_null( $params['diffs'] ) ) {
+ $this->useDiffs = true;
+ $fauxReqArr['wlprop'] .= '|ids';
+ }
+
// Check for 'allrev' parameter, and if found, show all revisions to each page on wl.
if ( !is_null( $params['allrev'] ) ) {
$fauxReqArr['wlallrev'] = '';
@@ -135,7 +143,11 @@
private function createFeedItem( $info ) {
$titleStr = $info['title'];
$title = Title::newFromText( $titleStr );
- $titleUrl = $title->getFullURL();
+ if ( $this->useDiffs and array_key_exists('revid', $info) ) {
+ $titleUrl = $title->getFullURL(array( 'diff' => $info['revid'] ) );
+ } else {
+ $titleUrl = $title->getFullURL();
+ }
$comment = isset( $info['comment'] ) ? $info['comment'] : null;
$timestamp = $info['timestamp'];
$user = $info['user'];
@@ -165,7 +177,8 @@
),
'wltoken' => array(
ApiBase::PARAM_TYPE => 'string'
- )
+ ),
+ 'diffs' => null
);
}
@@ -174,8 +187,9 @@
'feedformat' => 'The format of the feed',
'hours' => 'List pages modified within this many hours from now',
'allrev' => 'Include multiple revisions of the same page within given timeframe',
- 'wlowner' => "The user whose watchlist you want (must be accompanied by {$this->getModulePrefix()}token if it's not you)",
- 'wltoken' => 'Security token that requested user set in their preferences'
+ 'wlowner' => "The user whose watchlist you want (must be accompanied by {$this->getModulePrefix()}token if it's not you)",
+ 'wltoken' => 'Security token that requested user set in their preferences',
+ 'diffs' => 'Link to change differences instead of article pages'
);
}
@@ -185,7 +199,8 @@
protected function getExamples() {
return array(
- 'api.php?action=feedwatchlist'
+ 'api.php?action=feedwatchlist',
+ 'api.php?action=feedwatchlist&allrev=allrev&diffs=diffs&hours=6'
);
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3689
Default Alt Text
ApiFeedWatchlist.php.patch (2 KB)
Attached To
Mode
T12268: Watchlist RSS feed should include diffs
Attached
Detach File
Event Timeline
Log In to Comment