]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/Bookmark/BookmarkPlugin.php
Make Profile::fromUri use UnknownUriException
[quix0rs-gnu-social.git] / plugins / Bookmark / BookmarkPlugin.php
index e6a2d45290bb99bf6ceb9ae8b6fec2c5b504a2e6..381dc4dfc936ba715b6e99328b4274c43b199442 100644 (file)
@@ -387,16 +387,15 @@ class BookmarkPlugin extends MicroAppPlugin
         $options['replies'] = array();  // TODO: context->attention
 
         foreach ($activity->context->attention as $attnUrl=>$type) {
-            $other = Profile::fromURI($attnUrl);
-            if ($other instanceof Profile) {
-                $options['replies'][] = $attnUrl;
-            } else {
-                // Maybe we can get rid of this since every User_group got a Profile?
-                // TODO: Make sure the above replies get sorted properly for groups (or handled afterwards)
-                $group = User_group::getKV('uri', $attnUrl);
-                if ($group instanceof User_group) {
-                    $options['groups'][] = $attnUrl;
+            try {
+                $other = Profile::fromUri($attnUrl);
+                if ($other->isGroup()) {
+                    $options['groups'][] = $other->id;
+                } else {
+                    $options['replies'][] = $attnUrl;
                 }
+            } catch (UnknownUriException $e) {
+                // We simply don't know this URI, despite lookup attempts.
             }
         }