]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Minor fixes in Linkback plugin
authorMikael Nordfeldth <mmn@hethane.se>
Thu, 14 Jan 2016 18:14:24 +0000 (19:14 +0100)
committerMikael Nordfeldth <mmn@hethane.se>
Thu, 14 Jan 2016 18:14:24 +0000 (19:14 +0100)
plugins/Linkback/LinkbackPlugin.php

index dbc88188439e9be3a73eade4f7215867dd727c74..64165199eb3bb093459a577ebcf3cd437f43eb64 100644 (file)
@@ -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);
             }