]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Better error handling in Bookmark
authorMikael Nordfeldth <mmn@hethane.se>
Mon, 12 Oct 2015 16:28:32 +0000 (18:28 +0200)
committerMikael Nordfeldth <mmn@hethane.se>
Mon, 12 Oct 2015 16:28:32 +0000 (18:28 +0200)
lib/activityhandlerplugin.php
plugins/Bookmark/BookmarkPlugin.php

index 2544179c5e2e96a6a196f75de45325fa737674f0..8b2a458454711187e059d7dc7c39fea4dbf8763d 100644 (file)
@@ -625,7 +625,11 @@ abstract class ActivityHandlerPlugin extends Plugin
             return true;
         }
 
-        $this->showNoticeContent($stored, $out, $scoped);
+        try {
+            $this->showNoticeContent($stored, $out, $scoped);
+        } catch (Exception $e) {
+            $out->element('div', 'error', $e->getMessage());
+        }
         return false;
     }
 
index 1b2f461855d77fe058ee02ecd84c09a27ea0f19d..8b4abd2b42ba0c92e77c2680fceb7db58e936bd4 100644 (file)
@@ -379,20 +379,10 @@ class BookmarkPlugin extends MicroAppPlugin
         return true;
     }
 
-    protected function showNoticeItemNotice(NoticeListItem $nli)
-    {
-        $nli->out->elementStart('div', 'entry-title');
-        $nli->showAuthor();
-        $nli->showContent();
-        $nli->out->elementEnd('div');
-    }
-
     protected function showNoticeContent(Notice $stored, HTMLOutputter $out, Profile $scoped=null)
     {
         $nb = Bookmark::fromStored($stored);
 
-        $profile = $stored->getProfile();
-
         // Whether to nofollow
         $attrs = array('href' => $nb->getUrl(), 'class' => 'bookmark-title');
 
@@ -405,7 +395,7 @@ class BookmarkPlugin extends MicroAppPlugin
         }
 
         $out->elementStart('h3');
-        $out->element('a', $attrs, $nb->title);
+        $out->element('a', $attrs, $nb->getTitle());
         $out->elementEnd('h3');
 
         // Replies look like "for:" tags
@@ -423,16 +413,14 @@ class BookmarkPlugin extends MicroAppPlugin
             $out->elementStart('ul', array('class' => 'bookmark-tags'));
 
             foreach ($replies as $reply) {
-                $other = Profile::getKV('id', $reply);
-                if (!empty($other)) {
-                    $out->elementStart('li');
-                    $out->element('a', array('rel' => 'tag',
-                                             'href' => $other->profileurl,
-                                             'title' => $other->getBestName()),
-                                  sprintf('for:%s', $other->nickname));
-                    $out->elementEnd('li');
-                    $out->text(' ');
-                }
+                $other = Profile::getByPK($reply);
+                $out->elementStart('li');
+                $out->element('a', array('rel' => 'tag',
+                                         'href' => $other->getUrl(),
+                                         'title' => $other->getBestName()),
+                              sprintf('for:%s', $other->getNickname()));
+                $out->elementEnd('li');
+                $out->text(' ');
             }
 
             foreach ($tags as $tag) {