From: Evan Prodromou Date: Wed, 1 Sep 2010 18:35:43 +0000 (-0400) Subject: send a salmon slap to mentioned person when we reply to a notice X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c82b1cda825f3b84e3c3bef5474eccf8963b0475;p=quix0rs-gnu-social.git send a salmon slap to mentioned person when we reply to a notice --- diff --git a/plugins/OStatus/actions/usersalmon.php b/plugins/OStatus/actions/usersalmon.php index 641e131abc..54715cd657 100644 --- a/plugins/OStatus/actions/usersalmon.php +++ b/plugins/OStatus/actions/usersalmon.php @@ -71,6 +71,7 @@ class UsersalmonAction extends SalmonAction // Notice must either be a) in reply to a notice by this user // or b) to the attention of this user + // or c) in reply to a notice to the attention of this user $context = $this->activity->context; @@ -79,8 +80,9 @@ class UsersalmonAction extends SalmonAction if (empty($notice)) { throw new ClientException("In reply to unknown notice"); } - if ($notice->profile_id != $this->user->id) { - throw new ClientException("In reply to a notice not by this user"); + if ($notice->profile_id != $this->user->id && + !in_array($notice->getReplies(), $this->user->id)) { + throw new ClientException("In reply to a notice not by this user and not mentioning this user"); } } else if (!empty($context->attention)) { if (!in_array($this->user->uri, $context->attention) && diff --git a/plugins/OStatus/lib/ostatusqueuehandler.php b/plugins/OStatus/lib/ostatusqueuehandler.php index 8905d2e210..5e318116a6 100644 --- a/plugins/OStatus/lib/ostatusqueuehandler.php +++ b/plugins/OStatus/lib/ostatusqueuehandler.php @@ -67,6 +67,17 @@ class OStatusQueueHandler extends QueueHandler } } + if (!empty($this->notice->reply_to)) { + $replyTo = Notice::staticGet('id', $this->notice->reply_to); + if (!empty($replyTo)) { + foreach($replyTo->getReplies() as $profile_id) { + $oprofile = Ostatus_profile::staticGet('profile_id', $profile_id); + if ($oprofile) { + $this->pingReply($oprofile); + } + } + } + } return true; } @@ -161,7 +172,7 @@ class OStatusQueueHandler extends QueueHandler * Queue up direct feed update pushes to subscribers on our internal hub. * If there are a large number of subscriber sites, intermediate bulk * distribution triggers may be queued. - * + * * @param string $atom update feed, containing only new/changed items * @param HubSub $sub open query of subscribers */