From 33194b3cff8a787bde24607f47b20db796d75a2c Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Fri, 8 Jan 2016 02:58:31 +0100 Subject: [PATCH] Attention goes to the parent notice author too --- actions/newnotice.php | 2 +- lib/util.php | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/actions/newnotice.php b/actions/newnotice.php index f874e6f9cb..a97f439e24 100644 --- a/actions/newnotice.php +++ b/actions/newnotice.php @@ -189,7 +189,7 @@ class NewnoticeAction extends FormAction // FIXME: We should be able to get the attentions from common_render_content! // and maybe even directly save whether they're local or not! - $act->context->attention = common_find_attentions($content, $this->scoped, $parent); + $act->context->attention = common_get_attentions($content, $this->scoped, $parent); $actobj = new ActivityObject(); $actobj->type = ActivityObject::NOTE; diff --git a/lib/util.php b/lib/util.php index 62cd13af4a..7ce75e0fc0 100644 --- a/lib/util.php +++ b/lib/util.php @@ -681,7 +681,7 @@ function common_linkify_mention(array $mention) return $output; } -function common_find_attentions($text, Profile $sender, Notice $parent=null) +function common_get_attentions($text, Profile $sender, Notice $parent=null) { $mentions = common_find_mentions($text, $sender, $parent); $atts = array(); @@ -690,6 +690,11 @@ function common_find_attentions($text, Profile $sender, Notice $parent=null) $atts[$mentioned->getUri()] = $mentioned->isGroup() ? ActivityObject::GROUP : ActivityObject::PERSON; } } + if ($parent instanceof Notice) { + $parentAuthor = $parent->getProfile(); + // afaik groups can't be authors + $atts[$parentAuthor->getUri()] = ActivityObject::PERSON; + } return $atts; }