]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/Notice.php
getConversationUrl introduced for linking to conversations
[quix0rs-gnu-social.git] / classes / Notice.php
index a72e04746c5bdc1ab77c9e9d1fcc780f58b1c79a..7311a257a618180d3cdb688fbf8f7d73ea996784 100644 (file)
@@ -210,6 +210,27 @@ class Notice extends Managed_DataObject
         return $this->uri;
     }
 
+    /*
+     * @param $root boolean If true, link to just the conversation root.
+     *
+     * @return URL to conversation
+     */
+    public function getConversationUrl($anchor=true)
+    {
+        return Conversation::getUrlFromNotice($this, $anchor);
+    }
+
+    /*
+     * Get the local representation URL of this notice.
+     */
+    public function getLocalUrl()
+    {
+        return common_local_url('shownotice', array('notice' => $this->id), null, null, false);
+    }
+
+    /*
+     * Get the original representation URL of this notice.
+     */
     public function getUrl()
     {
         // The risk is we start having empty urls and non-http uris...
@@ -1697,17 +1718,6 @@ class Notice extends Managed_DataObject
         return $noun->asString('activity:' . $element);
     }
 
-    // FIXME: Replace all bestUrl with getUrl and do exception handling
-    function bestUrl()
-    {
-        try {
-            return $this->getUrl();
-        } catch (InvalidUrlException $e) {
-            return common_local_url('shownotice', array('notice' => $this->id));
-        }
-    }
-
-
     /**
      * Determine which notice, if any, a new notice is in reply to.
      *