From 3119341aeae5d5acc377eaad5fbb63b7c7bc1170 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Fri, 23 Jan 2015 12:37:27 +0100 Subject: [PATCH] Prefer local URLs for all locally generated notices. --- classes/Notice.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/Notice.php b/classes/Notice.php index 20374e0e2e..e15b6cbcb4 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -284,11 +284,11 @@ class Notice extends Managed_DataObject switch (true) { 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. + return $this->uri; case $this->isLocal(): // 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); - case common_valid_http_url($this->uri): - return $this->uri; default: common_debug('No URL available for notice: id='.$this->id); throw new InvalidUrlException($this->url);