EBernhardson has uploaded a new change for review.
https://gerrit.wikimedia.org/r/123114
Change subject: Provide better URLs to IRC rcfeed
......................................................................
Provide better URLs to IRC rcfeed
Bug: 60559
Change-Id: Ieee69baa0c094603547e3bcee4c879d29f9fe4e2
---
M Flow.php
M Hooks.php
2 files changed, 52 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow
refs/changes/14/123114/1
diff --git a/Flow.php b/Flow.php
index 05f183a..f15a6ec 100755
--- a/Flow.php
+++ b/Flow.php
@@ -227,6 +227,7 @@
$wgHooks['SpecialCheckUserGetLinksFromRow'][] =
'FlowHooks::onSpecialCheckUserGetLinksFromRow';
$wgHooks['MakeGlobalVariablesScript'][] =
'FlowHooks::onMakeGlobalVariablesScript';
$wgHooks['CheckUserInsertForRecentChange'][] =
'FlowHooks::onCheckUserInsertForRecentChange';
+$wgHooks['IRCLineURL'][] = 'FlowHooks::onIRCLineURL';
// Extension initialization
$wgExtensionFunctions[] = 'FlowHooks::initFlowExtension';
diff --git a/Hooks.php b/Hooks.php
index eb3e587..a4403d2 100644
--- a/Hooks.php
+++ b/Hooks.php
@@ -554,4 +554,55 @@
return true;
}
+
+ public static function onIRCLineURL( &$url, &$query, RecentChange $rc )
{
+ if ( $rc->getAttribute( 'rc_source' ) !==
Flow\Data\RecentChanges::SRC_FLOW ) {
+ return true;
+ }
+
+ $params = unserialize( $rc->getAttribute( 'rc_params' ) );
+ if ( !isset( $params['flow-workflow-change'] ) ) {
+ wfDebugLog( 'Flow', __METHOD__ . ': No
flow-workflow-change attribute in rc ' . $rc->getAttribute( 'rc_id' ) );
+ return true;
+ }
+
+ $change = $params['flow-workflow-change'];
+ if ( !isset( $change['action'], $change['workflow'],
$change['revision'] ) ) {
+ wfDebugLog( 'Flow', __METHOD__ . ': Malformed rc ' .
$rc->getAttribute( 'rc_id' ) );
+ return true;
+ }
+
+ $links = Container::get( 'formatter.revision' )
+ ->buildActionLinks(
+ $rc->getTitle(),
+ $change['action'],
+ UUID::create( $change['workflow'] ),
+ UUID::create( $change['revision'] ),
+ isset( $change['post'] ) ? UUID::create(
$change['post'] ) : null
+ );
+
+ // Listed in order of preference
+ $accept = array(
+ 'diff',
+ 'post-history', 'topic-history', 'board-history',
+ 'post', 'topic',
+ 'workflow'
+ );
+
+ foreach ( $accept as $key ) {
+ if ( isset( $links[$key] ) ) {
+ // As of 4-1-2014 IRCColourfulRCFeedFormatter
just does
+ // $url .= $query;
+ // so its safe to build a full link and blank
the query.
+ $url = $links[$key][0];
+ $query = '';
+
+ return true;
+ }
+ }
+
+ wfDebugLog( 'Flow', __METHOD__ . ': No url generated for action
' . $change['action'] . ' on revision ' . $change['revision'] );
+
+ return true;
+ }
}
--
To view, visit https://gerrit.wikimedia.org/r/123114
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ieee69baa0c094603547e3bcee4c879d29f9fe4e2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits