]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
deprecate Notice::bestUrl() in favor of getUrl()
authorMikael Nordfeldth <mmn@hethane.se>
Sat, 19 Apr 2014 20:24:40 +0000 (22:24 +0200)
committerMikael Nordfeldth <mmn@hethane.se>
Sun, 20 Apr 2014 13:28:31 +0000 (15:28 +0200)
classes/Notice.php

index e46ed227a179cbb4cd4f9119a2b2bcb4a7e13ffd..0264c62275c67ebaac8e1bb33023855628cb360d 100644 (file)
@@ -1697,15 +1697,13 @@ class Notice extends Managed_DataObject
         return $noun->asString('activity:' . $element);
     }
 
+    // FIXME: Replace all bestUrl with getUrl and do exception handling
     function bestUrl()
     {
-        if (!empty($this->url)) {
-            return $this->url;
-        } else if (!empty($this->uri) && preg_match('/^https?:/', $this->uri)) {
-            return $this->uri;
-        } else {
-            return common_local_url('shownotice',
-                                    array('notice' => $this->id));
+        try {
+            return $this->getUrl();
+        } catch (InvalidUrlException $e) {
+            return common_local_url('shownotice', array('notice' => $this->id));
         }
     }