Always generate notice URLs on the fly for local notices
Related to issue #118
This commit is contained in:
parent
1a1e44cdfd
commit
4352d1739d
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user