]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
If Router is mucked up, force URI for Bookmark
authorEvan Prodromou <evan@status.net>
Thu, 31 Mar 2011 15:20:24 +0000 (11:20 -0400)
committerEvan Prodromou <evan@status.net>
Thu, 31 Mar 2011 15:20:24 +0000 (11:20 -0400)
plugins/Bookmark/Bookmark.php

index 777b50f7243d74f7244f84640cf163d902045b57..48709d1387c4208c8e5454249f605bf877c0552d 100644 (file)
@@ -238,8 +238,23 @@ class Bookmark extends Memcached_DataObject
         if (array_key_exists('uri', $options)) {
             $nb->uri = $options['uri'];
         } else {
-            $nb->uri = common_local_url('showbookmark',
-                                        array('id' => $nb->id));
+            // FIXME: hacks to work around router bugs in
+            // queue daemons
+
+            $r = Router::get();
+
+            $path = $r->build('showbookmark',
+                              array('id' => $nb->id));
+
+            if (empty($path)) {
+                $nb->uri = common_path('bookmark/'.$nb->id, false, false);
+            } else {
+                $nb->uri = common_local_url('showbookmark',
+                                            array('id' => $nb->id),
+                                            null,
+                                            null,
+                                            false);
+            }
         }
 
         $nb->insert();