From: Stephen Paul Weber Date: Fri, 23 Oct 2015 17:56:02 +0000 (+0000) Subject: Include rel-syndication link for tweets X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=983fd75ec9ce254423f8a2b10c4c0467d78d6869;p=quix0rs-gnu-social.git Include rel-syndication link for tweets As per: This allows some services to find a post in Twitter. --- diff --git a/plugins/TwitterBridge/TwitterBridgePlugin.php b/plugins/TwitterBridge/TwitterBridgePlugin.php index dd3007e309..72c28d4fa4 100644 --- a/plugins/TwitterBridge/TwitterBridgePlugin.php +++ b/plugins/TwitterBridge/TwitterBridgePlugin.php @@ -527,6 +527,23 @@ class TwitterBridgePlugin extends Plugin public function onEndShowHeadElements(Action $action) { + if($action instanceof ShowNoticeAction) { // Showing a notice + $notice = Notice::getKV('id', $action->arg('notice')); + + try { + $flink = Foreign_link::getByUserID($notice->profile_id, TWITTER_SERVICE); + $fuser = Foreign_user::getForeignUser($flink->foreign_id, TWITTER_SERVICE); + } catch (NoResultException $e) { + return true; + } + + $statusId = twitter_status_id($notice); + if($notice instanceof Notice && $notice->isLocal() && $statusId) { + $tweetUrl = 'https://twitter.com/' . $fuser->nickname . '/status/' . $statusId; + $action->element('link', array('rel' => 'syndication', 'href' => $tweetUrl)); + } + } + if (!($action instanceof AttachmentAction)) { return true; }