]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
add displayName and targetUrl to activity JSON
authorEvan Prodromou <evan@status.net>
Sun, 22 Jan 2012 02:12:20 +0000 (21:12 -0500)
committerEvan Prodromou <evan@status.net>
Sun, 22 Jan 2012 02:12:20 +0000 (21:12 -0500)
plugins/Bookmark/BookmarkPlugin.php

index ff68917bcca36a683f5651f47eed337b3461e13c..319366c19bae017ce8b427cae98d0f63a7904630 100644 (file)
@@ -572,4 +572,20 @@ class BookmarkPlugin extends MicroAppPlugin
             $notice->update($original);
         }
     }
+
+    public function activityObjectOutputJson(ActivityObject $obj, array &$out)
+    {
+        assert($obj->type == ActivityObject::BOOKMARK);
+
+        $bm = Bookmark::staticGet('uri', $obj->id);
+
+        if (empty($bm)) {
+            throw new ServerException("Unknown bookmark: " . $obj->id);
+        }
+
+        $out['displayName'] = $bm->title;
+        $out['targetUrl']   = $bm->url;
+
+        return true;
+    }
 }