From 4352d1739dc3816f83ad5f93a60827571144b310 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Wed, 6 Jan 2016 16:24:33 +0100 Subject: [PATCH] Always generate notice URLs on the fly for local notices Related to issue #118 --- classes/Notice.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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); } } -- 2.39.5