X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=plugins%2FDirectMessage%2FDirectMessagePlugin.php;h=34533ba9e82cf5406c960aeb484168ca60d91c2e;hb=d6b28c64830f632bb2f4b6f3c9369b9e56ad217a;hp=f24c043065a9eb5d2853af5535f1636db9d6ca67;hpb=1111187d845ecd34eba1c03473f6adbc08f6ca15;p=quix0rs-gnu-social.git diff --git a/plugins/DirectMessage/DirectMessagePlugin.php b/plugins/DirectMessage/DirectMessagePlugin.php index f24c043065..34533ba9e8 100644 --- a/plugins/DirectMessage/DirectMessagePlugin.php +++ b/plugins/DirectMessage/DirectMessagePlugin.php @@ -58,20 +58,24 @@ class DirectMessagePlugin extends Plugin public function onAppendUserActivityStreamObjects(UserActivityStream $uas, array &$objs) { // Messages _from_ the user - $msgMap = Message::listGet('from_profile', array($this->user->id)); - $messages = $msgMap[$uas->user->id]; + $msgMap = Message::listGet('from_profile', array($uas->getUser()->id)); + $messages = $msgMap[$uas->getUser()->id]; if (!empty($uas->after)) { $messages = array_filter($messages, array($uas, 'createdAfter')); } - $objs[] = $messages; + foreach ($messages as $message) { + $objs[] = clone($message); + } // Messages _to_ the user - $msgMap = Message::listGet('to_profile', array($this->user->id)); - $messages = $msgMap[$uas->user->id]; + $msgMap = Message::listGet('to_profile', array($uas->getUser()->id)); + $messages = $msgMap[$uas->getUser()->id]; if (!empty($uas->after)) { $messages = array_filter($messages, array($uas, 'createdAfter')); } - $objs[] = $messages; + foreach ($messages as $message) { + $objs[] = clone($message); + } return true; } @@ -145,7 +149,7 @@ class DirectMessagePlugin extends Plugin return true; } - public function onProfileDeleteRelated(Profile $profile, &$related) + public function onProfileDeleteRelated(Profile $profile, array &$related) { $msg = new Message(); $msg->from_profile = $profile->id;