EBernhardson has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/132105

Change subject: Allow extensions to handle their contributions entries
......................................................................

Allow extensions to handle their contributions entries

Extensions have the opportunity to independantly query
for contributions entries via the ContribsPager::reallyDoQuery
hook.  This allows extensions to also handle the conversion
of that query result into a FeedItem instance.

Bug: 64940
Change-Id: Ic1afb7c15d6e59f5eadfaed1f84062d31380c9a6
---
M RELEASE-NOTES-1.24
M docs/hooks.txt
M includes/api/ApiFeedContributions.php
3 files changed, 13 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/05/132105/1

diff --git a/RELEASE-NOTES-1.24 b/RELEASE-NOTES-1.24
index aaabb6b..706d3de 100644
--- a/RELEASE-NOTES-1.24
+++ b/RELEASE-NOTES-1.24
@@ -13,6 +13,9 @@
 === New features in 1.24 ===
 * Added a new hook, "WhatLinksHereProps", to allow extensions to annotate
   WhatLinksHere entries.
+* Added a new hook, "ApiFeedContributions::feedItem" to allow extensions
+  to control the conversion of a contributions row into a FeedItem 
+  instance
 
 === Bug fixes in 1.24 ===
 * (bug 62258) A bug was fixed in File::getUnscaledThumb when a height
diff --git a/docs/hooks.txt b/docs/hooks.txt
index 688e0cd..43374f23 100644
--- a/docs/hooks.txt
+++ b/docs/hooks.txt
@@ -382,6 +382,11 @@
 $text : the new text of the article (has yet to be saved)
 &$resultArr : data in this array will be added to the API result
 
+'APIFeedContributions::feedItem': Gives extensions the opportunity to control
+the conversion of ContribsPager result rows into FeedItem instances.
+$row: A single row from ContribsPager
+&$result: the hook must set this to a FeedItem instance in cases
+
 'APIGetAllowedParams': Use this hook to modify a module's parameters.
 &$module: ApiBase Module object
 &$params: Array of parameters
diff --git a/includes/api/ApiFeedContributions.php 
b/includes/api/ApiFeedContributions.php
index 6f7121b..6c2d873 100644
--- a/includes/api/ApiFeedContributions.php
+++ b/includes/api/ApiFeedContributions.php
@@ -103,6 +103,11 @@
        }
 
        protected function feedItem( $row ) {
+               wfRunHooks( 'ApiFeedContributions::feedItem', array( $row, 
&$result ) );
+               if ( $result instanceof FeedItem ) {
+                       return $result;
+               }
+
                $title = Title::makeTitle( intval( $row->page_namespace ), 
$row->page_title );
                if ( $title && $title->userCan( 'read', $this->getUser() ) ) {
                        $date = $row->rev_timestamp;

-- 
To view, visit https://gerrit.wikimedia.org/r/132105
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic1afb7c15d6e59f5eadfaed1f84062d31380c9a6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <ebernhard...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to