From 13bebec50eb39ca443ed1aa401e3fcac18a447cd Mon Sep 17 00:00:00 2001 From: Bryan Tong Minh Date: Sat, 27 Nov 2010 19:24:48 +0000 Subject: [PATCH] (bug 10268) Added linktodiffs parameter on action=feedwatchlist --- CREDITS | 1 + RELEASE-NOTES | 1 + includes/api/ApiFeedWatchlist.php | 25 ++++++++++++++++++++----- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/CREDITS b/CREDITS index e683744c1c..42ef046a22 100644 --- a/CREDITS +++ b/CREDITS @@ -135,6 +135,7 @@ following names for their contribution to the product. * svip * Tisane * Umherirrender +* Ville Stadista * Zachary Hauri == Translators == diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 8959b6b5c6..364dbc3fd6 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -539,6 +539,7 @@ LocalSettings.php. The specific bugs are listed below in the general notes. * (bug 26089) add block expiration to blockinfo * (bug 26125) prop=imageinfo&iiprop=size now returns the page count if the file is a multi-page file +* (bug 10268) Added linktodiffs parameter on action=feedwatchlist === Languages updated in 1.17 === diff --git a/includes/api/ApiFeedWatchlist.php b/includes/api/ApiFeedWatchlist.php index 31462a329d..f572ae616d 100644 --- a/includes/api/ApiFeedWatchlist.php +++ b/includes/api/ApiFeedWatchlist.php @@ -49,6 +49,8 @@ class ApiFeedWatchlist extends ApiBase { return new ApiFormatFeedWrapper( $this->getMain() ); } + private $linkToDiffs = 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 @@ class ApiFeedWatchlist extends ApiBase { $fauxReqArr['wltoken'] = $params['wltoken']; } + // Support linking to diffs instead of article + if ( $params['linktodiffs'] ) { + $this->linkToDiffs = 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 @@ class ApiFeedWatchlist extends ApiBase { private function createFeedItem( $info ) { $titleStr = $info['title']; $title = Title::newFromText( $titleStr ); - $titleUrl = $title->getFullURL(); + if ( $this->linkToDiffs and isset( $info['revid'] ) ) { + $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 @@ class ApiFeedWatchlist extends ApiBase { ), 'wltoken' => array( ApiBase::PARAM_TYPE => 'string' - ) + ), + 'linktodiffs' => false, ); } @@ -174,8 +187,9 @@ class ApiFeedWatchlist extends ApiBase { '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', + 'linktodiffs' => 'Link to change differences instead of article pages' ); } @@ -185,7 +199,8 @@ class ApiFeedWatchlist extends ApiBase { protected function getExamples() { return array( - 'api.php?action=feedwatchlist' + 'api.php?action=feedwatchlist', + 'api.php?action=feedwatchlist&allrev=allrev&linktodiffs=&hours=6' ); } -- 2.20.1