From: Mikael Nordfeldth Date: Wed, 6 Jan 2016 15:24:33 +0000 (+0100) Subject: Always generate notice URLs on the fly for local notices X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4352d1739dc3816f83ad5f93a60827571144b310;p=quix0rs-gnu-social.git Always generate notice URLs on the fly for local notices Related to issue #118 --- diff --git a/classes/Notice.php b/classes/Notice.php index cbd00e802b..208e4be9a7 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -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); } }