From 2af9de4f23b7e07582449f821383fac3aefb8378 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Thu, 14 Jan 2016 19:14:24 +0100 Subject: [PATCH] Minor fixes in Linkback plugin --- plugins/Linkback/LinkbackPlugin.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/plugins/Linkback/LinkbackPlugin.php b/plugins/Linkback/LinkbackPlugin.php index dbc8818843..64165199eb 100644 --- a/plugins/Linkback/LinkbackPlugin.php +++ b/plugins/Linkback/LinkbackPlugin.php @@ -79,11 +79,17 @@ class LinkbackPlugin extends Plugin $repeat = Notice::getByID($notice->repeat_of); $this->linkbackUrl($repeat->getUrl()); } else if(!empty($notice->reply_to)) { - $parent = $notice->getParent(); - $this->linkbackUrl($parent->getUrl()); + try { + $parent = $notice->getParent(); + $this->linkbackUrl($parent->getUrl()); + } catch (NoParentNoticeException $e) { + // can't link back to what we don't know (apparently parent notice disappeared from our db) + return true; + } } - $replyProfiles = Profile::multiGet('id', $notice->getReplies()); + // doubling up getReplies and getAttentionProfileIDs because we're not entirely migrated yet + $replyProfiles = Profile::multiGet('id', array_unique(array_merge($notice->getReplies(), $notice->getAttentionProfileIDs()))); foreach($replyProfiles->fetchAll('profileurl') as $profileurl) { $this->linkbackUrl($profileurl); }