Mattflaschen has uploaded a new change for review. https://gerrit.wikimedia.org/r/232383
Change subject: Restore 'new topic' records to the watchlist ...................................................................... Restore 'new topic' records to the watchlist Internally, add exclude_from_recentchanges (only applies to Special:RecentChanges) and change rc_insert back to true. Also rename classes to standardize Formatter class names and reflect that these are used for more than just Special:RecentChanges. Bug: T108396 Change-Id: I9b13004b366e257c8999be30dff035f903e99929 (cherry picked from commit 956170076848e061bc69be4c99f7d2ce5e1694f1) --- M FlowActions.php M Hooks.php M autoload.php M container.php R includes/Formatter/ChangesListFormatter.php R includes/Formatter/ChangesListQuery.php R includes/Formatter/ContributionsFormatter.php M includes/Formatter/IRCLineUrlFormatter.php 8 files changed, 42 insertions(+), 34 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow refs/changes/83/232383/1 diff --git a/FlowActions.php b/FlowActions.php index 71efa05..3e696b9 100644 --- a/FlowActions.php +++ b/FlowActions.php @@ -249,9 +249,12 @@ 'new-topic' => array( 'performs-writes' => true, 'log_type' => false, - 'rc_insert' => false, + 'rc_title' => 'owner', + 'rc_insert' => true, 'exclude_from_contributions' => true, 'exclude_from_history' => true, + // exclude_from_recentchanges only refers to the actual Special:RecentChanges. It does not affect Special:Watchlist. + 'exclude_from_recentchanges' => true, 'permissions' => array( PostRevision::MODERATED_NONE => '', ), diff --git a/Hooks.php b/Hooks.php index 6720c1c..4c8a7a1 100644 --- a/Hooks.php +++ b/Hooks.php @@ -270,8 +270,8 @@ set_error_handler( new Flow\RecoverableErrorHandler, -1 ); try { - /** @var Flow\Formatter\RecentChangesQuery $query */ - $query = Container::get( 'query.recentchanges' ); + /** @var Flow\Formatter\ChangesListQuery $query */ + $query = Container::get( 'query.changeslist' ); $query->loadMetadataBatch( $rows, $changesList->isWatchlist() @@ -361,8 +361,8 @@ set_error_handler( new Flow\RecoverableErrorHandler, -1 ); try { - /** @var Flow\Formatter\RecentChangesQuery $query */ - $query = Container::get( 'query.recentchanges' ); + /** @var Flow\Formatter\ChangesListQuery $query */ + $query = Container::get( 'query.changeslist' ); $row = $query->getResult( $changesList, $rc, $changesList->isWatchlist() ); if ( $row === false ) { @@ -370,8 +370,8 @@ return false; } - /** @var Flow\Formatter\RecentChanges $formatter */ - $formatter = Container::get( 'formatter.recentchanges' ); + /** @var Flow\Formatter\ChangesListFormatter $formatter */ + $formatter = Container::get( 'formatter.changeslist' ); $line = $formatter->format( $row, $changesList, $topicOnly ); } catch ( Exception $e ) { wfDebugLog( 'Flow', __METHOD__ . ': Exception formatting rc ' . $rc->getAttribute( 'rc_id' ) . ' ' . $e ); @@ -414,8 +414,8 @@ set_error_handler( new Flow\RecoverableErrorHandler, -1 ); try { - /** @var Flow\Formatter\RecentChangesQuery $query */ - $query = Container::get( 'query.recentchanges' ); + /** @var Flow\Formatter\ChangesListQuery $query */ + $query = Container::get( 'query.changeslist' ); $row = $query->getResult( $changesList, $rc, $changesList->isWatchlist() ); if ( $row === false ) { @@ -423,8 +423,8 @@ return false; } - /** @var Flow\Formatter\RecentChanges $formatter */ - $formatter = Container::get( 'formatter.recentchanges' ); + /** @var Flow\Formatter\ChangesListFormatter $formatter */ + $formatter = Container::get( 'formatter.changeslist' ); $logTextLinks = $formatter->getLogTextLinks( $row, $changesList, $block, $links ); } catch ( Exception $e ) { wfDebugLog( 'Flow', __METHOD__ . ': Exception formatting rc logtext ' . $rc->getAttribute( 'rc_id' ) . ' ' . $e ); @@ -465,14 +465,14 @@ return true; } - $query = Container::get( 'query.recentchanges' ); + $query = Container::get( 'query.changeslist' ); $row = $query->getResult( $changesList, $rc, $changesList->isWatchlist() ); if ( $row === false ) { return false; } - /** @var Flow\Formatter\RecentChanges $formatter */ - $formatter = Container::get( 'formatter.recentchanges' ); + /** @var Flow\Formatter\ChangesListFormatter $formatter */ + $formatter = Container::get( 'formatter.changeslist' ); try { $data['timestampLink'] = $formatter->getTimestampLink( $row, $changesList ); $data['recentChangesFlags'] = $formatter->getFlags( $row, $changesList ); @@ -712,7 +712,7 @@ set_error_handler( new Flow\RecoverableErrorHandler, -1 ); try { - /** @var Flow\Formatter\Contributions $formatter */ + /** @var Flow\Formatter\ContributionsFormatter $formatter */ $formatter = Container::get( 'formatter.contributions' ); $line = $formatter->format( $row, $pager ); } catch ( Exception $e ) { diff --git a/autoload.php b/autoload.php index c6d1cf6..609ae5a 100644 --- a/autoload.php +++ b/autoload.php @@ -132,10 +132,12 @@ 'Flow\\Formatter\\BoardHistoryQuery' => __DIR__ . '/includes/Formatter/BoardHistoryQuery.php', 'Flow\\Formatter\\CategoryViewerFormatter' => __DIR__ . '/includes/Formatter/CategoryViewerFormatter.php', 'Flow\\Formatter\\CategoryViewerQuery' => __DIR__ . '/includes/Formatter/CategoryViewerQuery.php', + 'Flow\\Formatter\\ChangesListFormatter' => __DIR__ . '/includes/Formatter/ChangesListFormatter.php', + 'Flow\\Formatter\\ChangesListQuery' => __DIR__ . '/includes/Formatter/ChangesListQuery.php', 'Flow\\Formatter\\CheckUserFormatter' => __DIR__ . '/includes/Formatter/CheckUserFormatter.php', 'Flow\\Formatter\\CheckUserQuery' => __DIR__ . '/includes/Formatter/CheckUserQuery.php', 'Flow\\Formatter\\CheckUserRow' => __DIR__ . '/includes/Formatter/CheckUserQuery.php', - 'Flow\\Formatter\\Contributions' => __DIR__ . '/includes/Formatter/Contributions.php', + 'Flow\\Formatter\\ContributionsFormatter' => __DIR__ . '/includes/Formatter/ContributionsFormatter.php', 'Flow\\Formatter\\ContributionsQuery' => __DIR__ . '/includes/Formatter/ContributionsQuery.php', 'Flow\\Formatter\\ContributionsRow' => __DIR__ . '/includes/Formatter/ContributionsQuery.php', 'Flow\\Formatter\\DeletedContributionsRow' => __DIR__ . '/includes/Formatter/ContributionsQuery.php', @@ -147,9 +149,7 @@ 'Flow\\Formatter\\PostSummaryQuery' => __DIR__ . '/includes/Formatter/PostSummaryQuery.php', 'Flow\\Formatter\\PostSummaryViewQuery' => __DIR__ . '/includes/Formatter/RevisionViewQuery.php', 'Flow\\Formatter\\PostViewQuery' => __DIR__ . '/includes/Formatter/RevisionViewQuery.php', - 'Flow\\Formatter\\RecentChanges' => __DIR__ . '/includes/Formatter/RecentChanges.php', - 'Flow\\Formatter\\RecentChangesQuery' => __DIR__ . '/includes/Formatter/RecentChangesQuery.php', - 'Flow\\Formatter\\RecentChangesRow' => __DIR__ . '/includes/Formatter/RecentChangesQuery.php', + 'Flow\\Formatter\\RecentChangesRow' => __DIR__ . '/includes/Formatter/ChangesListQuery.php', 'Flow\\Formatter\\RevisionDiffViewFormatter' => __DIR__ . '/includes/Formatter/RevisionDiffViewFormatter.php', 'Flow\\Formatter\\RevisionFormatter' => __DIR__ . '/includes/Formatter/RevisionFormatter.php', 'Flow\\Formatter\\RevisionUndoViewFormatter' => __DIR__ . '/includes/Formatter/RevisionUndoViewFormatter.php', diff --git a/container.php b/container.php index ff266d2..cc0331a 100644 --- a/container.php +++ b/container.php @@ -916,8 +916,8 @@ $c['repository.tree'] ); }; -$c['query.recentchanges'] = function( $c ) { - $query = new Flow\Formatter\RecentChangesQuery( +$c['query.changeslist'] = function( $c ) { + $query = new Flow\Formatter\ChangesListQuery( $c['storage'], $c['repository.tree'], $c['flow_actions'] @@ -954,8 +954,8 @@ $c['permissions'] ); }; -$c['formatter.recentchanges'] = function( $c ) { - return new Flow\Formatter\RecentChanges( +$c['formatter.changeslist'] = function( $c ) { + return new Flow\Formatter\ChangesListFormatter( $c['permissions'], $c['formatter.revision'] ); @@ -971,7 +971,7 @@ ); }; $c['formatter.contributions'] = function( $c ) { - return new Flow\Formatter\Contributions( + return new Flow\Formatter\ContributionsFormatter( $c['permissions'], $c['formatter.revision'] ); diff --git a/includes/Formatter/RecentChanges.php b/includes/Formatter/ChangesListFormatter.php similarity index 98% rename from includes/Formatter/RecentChanges.php rename to includes/Formatter/ChangesListFormatter.php index 114ab28..4981cc5 100644 --- a/includes/Formatter/RecentChanges.php +++ b/includes/Formatter/ChangesListFormatter.php @@ -12,7 +12,7 @@ use IContextSource; use Linker; -class RecentChanges extends AbstractFormatter { +class ChangesListFormatter extends AbstractFormatter { protected function getHistoryType() { return 'recentchanges'; } diff --git a/includes/Formatter/RecentChangesQuery.php b/includes/Formatter/ChangesListQuery.php similarity index 90% rename from includes/Formatter/RecentChangesQuery.php rename to includes/Formatter/ChangesListQuery.php index 0f75960..d502c07 100644 --- a/includes/Formatter/RecentChangesQuery.php +++ b/includes/Formatter/ChangesListQuery.php @@ -10,7 +10,7 @@ use Flow\Repository\TreeRepository; use RecentChange; -class RecentChangesQuery extends AbstractQuery { +class ChangesListQuery extends AbstractQuery { /** * Check if the most recent action for an entity has been displayed already @@ -69,7 +69,7 @@ if ( !isset( $changeData['revision_type'] ) ) { continue; } - if ( $this->excludeFromRecentChanges( $changeData['action'] ) ) { + if ( $this->excludeFromChangesList( $isWatchlist, $changeData['action'] ) ) { continue; } if ( $isWatchlist && $this->isRecordHidden( $changeData ) ) { @@ -100,12 +100,17 @@ } /** - * @param string $action + * @param bool $isWatchlist Whether this is Special:Watchlist + * @param string $action The Flow action this line represents * @return bool */ - private function excludeFromRecentChanges( $action ) { - $rcInsert = $this->actions->getValue( $action, 'rc_insert' ); - return !$rcInsert; + private function excludeFromChangesList( $isWatchlist, $action ) { + // If we want to exclude things from watchlist, we can add exclude_from_watchlist + if ( $isWatchlist ) { + return false; + } else { + return (bool) $this->actions->getValue( $action, 'exclude_from_recentchanges' ); + } } /** @@ -140,7 +145,7 @@ * RC entries are not being created for 'new-topic' action but * old records exists. This filters them out. */ - if ( $this->excludeFromRecentChanges( $changeData['action'] ) ) { + if ( $this->excludeFromChangesList( $isWatchlist, $changeData['action'] ) ) { return false; } diff --git a/includes/Formatter/Contributions.php b/includes/Formatter/ContributionsFormatter.php similarity index 97% rename from includes/Formatter/Contributions.php rename to includes/Formatter/ContributionsFormatter.php index 5448dfe..51ec52b 100644 --- a/includes/Formatter/Contributions.php +++ b/includes/Formatter/ContributionsFormatter.php @@ -10,7 +10,7 @@ use IContextSource; use Html; -class Contributions extends AbstractFormatter { +class ContributionsFormatter extends AbstractFormatter { protected function getHistoryType() { return 'contributions'; } diff --git a/includes/Formatter/IRCLineUrlFormatter.php b/includes/Formatter/IRCLineUrlFormatter.php index edae039..c4334e4 100644 --- a/includes/Formatter/IRCLineUrlFormatter.php +++ b/includes/Formatter/IRCLineUrlFormatter.php @@ -62,7 +62,7 @@ */ protected function serializeRcRevision( RecentChange $rc, IContextSource $ctx ) { /** @var RecentChangesQuery $query */ - $query = Container::get( 'query.recentchanges' ); + $query = Container::get( 'query.changeslist' ); $query->loadMetadataBatch( array( (object)$rc->mAttribs ) ); $rcRow = $query->getResult( null, $rc ); -- To view, visit https://gerrit.wikimedia.org/r/232383 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9b13004b366e257c8999be30dff035f903e99929 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Flow Gerrit-Branch: wmf/1.26wmf18 Gerrit-Owner: Mattflaschen <mflasc...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits