jenkins-bot has submitted this change and it was merged.
Change subject: Allow hooks to abort lines in EnhancedRC
..
Allow hooks to abort lines in EnhancedRC
Bug: T104564
Change-Id: I4a2f97d83f38071984d571773a6b09b6b6643d6d
---
M docs/hooks.txt
M includes/changes/EnhancedChangesList.php
2 files changed, 12 insertions(+), 2 deletions(-)
Approvals:
Legoktm: Looks good to me, approved
jenkins-bot: Verified
diff --git a/docs/hooks.txt b/docs/hooks.txt
index 92bc95a..23df983 100644
--- a/docs/hooks.txt
+++ b/docs/hooks.txt
@@ -1300,12 +1300,14 @@
'EnhancedChangesList::getLogText': to alter, remove or add to the links of a
group of changes in EnhancedChangesList.
+Hook subscribers can return false to omit this line from recentchanges.
$changesList: EnhancedChangesList object
$links: The links that were generated by EnhancedChangesList
$block: The RecentChanges objects in that block
'EnhancedChangesListModifyLineData': to alter data used to build
a grouped recent change inner line in EnhancedChangesList.
+Hook subscribers can return false to omit this line from recentchanges.
$changesList: EnhancedChangesList object
$data: An array with all the components that will be joined in order to
create the line
$block: An array of RecentChange objects in that block
diff --git a/includes/changes/EnhancedChangesList.php
b/includes/changes/EnhancedChangesList.php
index fe7deb6..9635c17 100644
--- a/includes/changes/EnhancedChangesList.php
+++ b/includes/changes/EnhancedChangesList.php
@@ -378,8 +378,12 @@
$data['tags'] = $this-getTags( $rcObj, $classes );
// give the hook a chance to modify the data
- Hooks::run( 'EnhancedChangesListModifyLineData',
+ $success = Hooks::run(
'EnhancedChangesListModifyLineData',
array( $this, $data, $block, $rcObj ) );
+ if ( !$success ) {
+ // skip entry if hook aborted it
+ continue;
+ }
$line = 'tr' . $trClass . 'td/tdtd
class=mw-enhanced-rc';
if ( isset( $data['recentChangesFlags'] ) ) {
@@ -599,8 +603,12 @@
$data['watchingUsers'] = $this-numberofWatchingusers(
$rcObj-numberofWatchingusers );
// give the hook a chance to modify the data
- Hooks::run( 'EnhancedChangesListModifyBlockLineData',
+ $success = Hooks::run( 'EnhancedChangesListModifyBlockLineData',
array( $this, $data, $rcObj ) );
+ if ( !$success ) {
+ // skip entry if hook aborted it
+ return '';
+ }
$line = Html::openElement( 'table', array( 'class' = $classes
) ) .
Html::openElement( 'tr' );
--
To view, visit https://gerrit.wikimedia.org/r/85
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I4a2f97d83f38071984d571773a6b09b6b6643d6d
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie mmul...@wikimedia.org
Gerrit-Reviewer: Catrope roan.katt...@gmail.com
Gerrit-Reviewer: Legoktm legoktm.wikipe...@gmail.com
Gerrit-Reviewer: jenkins-bot
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits