]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/Bookmark/BookmarkPlugin.php
Merge branch '1.0.x' of gitorious.org:statusnet/mainline into 1.0.x
[quix0rs-gnu-social.git] / plugins / Bookmark / BookmarkPlugin.php
index e383f805608ec85cefd9be36a62529d3dbf7e07a..77b8a8483cfc6f244bdd3d041c6f61a0ff650139 100644 (file)
@@ -292,19 +292,27 @@ class BookmarkPlugin extends MicroAppPlugin
 
     function onStartOpenNoticeListItemElement($nli)
     {
+       if (!$this->isMyNotice($nli->notice)) {
+               return true;
+       }
+       
         $nb = Bookmark::getByNotice($nli->notice);
-        if (!empty($nb)) {
-            $id = (empty($nli->repeat)) ? $nli->notice->id : $nli->repeat->id;
-            $class = 'hentry notice bookmark';
-            if ($nli->notice->scope != 0 && $nli->notice->scope != 1) {
-                $class .= ' limited-scope';
-            }
-            $nli->out->elementStart('li', array('class' => $class,
-                                                 'id' => 'notice-' . $id));
-            Event::handle('EndOpenNoticeListItemElement', array($nli));
-            return false;
+        
+        if (empty($nb)) {
+               $this->log(LOG_INFO, "Notice {$nli->notice->id} has bookmark class but no matching Bookmark record.");
+               return true;
         }
-        return true;
+               
+           $id = (empty($nli->repeat)) ? $nli->notice->id : $nli->repeat->id;
+           $class = 'hentry notice bookmark';
+           if ($nli->notice->scope != 0 && $nli->notice->scope != 1) {
+               $class .= ' limited-scope';
+           }
+           $nli->out->elementStart('li', array('class' => $class,
+                                               'id' => 'notice-' . $id));
+                                               
+           Event::handle('EndOpenNoticeListItemElement', array($nli));
+           return false;
     }
 
     /**
@@ -355,12 +363,15 @@ class BookmarkPlugin extends MicroAppPlugin
      */
     function deleteRelated($notice)
     {
-        $nb = Bookmark::getByNotice($notice);
-
-        if (!empty($nb)) {
-            $nb->delete();
-        }
-
+       if ($this->isMyNotice($notice)) {
+               
+               $nb = Bookmark::getByNotice($notice);
+
+               if (!empty($nb)) {
+               $nb->delete();
+               }
+       }
+       
         return true;
     }