]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Always generate notice URLs on the fly for local notices
authorMikael Nordfeldth <mmn@hethane.se>
Wed, 6 Jan 2016 15:24:33 +0000 (16:24 +0100)
committerMikael Nordfeldth <mmn@hethane.se>
Wed, 6 Jan 2016 15:24:33 +0000 (16:24 +0100)
Related to issue #118

classes/Notice.php

index cbd00e802bb0bb1a7f87c31a50659eedf847132f..208e4be9a7e3c4b09b39471541b9a56f4ae310c6 100644 (file)
@@ -281,15 +281,17 @@ class Notice extends Managed_DataObject
         // The risk is we start having empty urls and non-http uris...
         // and we can't really handle any other protocol right now.
         switch (true) {
+        case $this->isLocal():
+            return common_local_url('shownotice', array('notice' => $this->getID()), null, null, false);
         case common_valid_http_url($this->url): // should we allow non-http/https URLs?
             return $this->url;
-        case !$this->isLocal() && common_valid_http_url($this->uri): // Sometimes we only have the URI for remote posts.
+        case common_valid_http_url($this->uri): // Sometimes we only have the URI for remote posts.
             return $this->uri;
-        case $this->isLocal() || $fallback:
+        case $fallback:
             // let's generate a valid link to our locally available notice on demand
-            return common_local_url('shownotice', array('notice' => $this->id), null, null, false);
+            return common_local_url('shownotice', array('notice' => $this->getID()), null, null, false);
         default:
-            common_debug('No URL available for notice: id='.$this->id);
+            common_debug('No URL available for notice: id='.$this->getID());
             throw new InvalidUrlException($this->url);
         }
     }