]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Redirect instead of showing an error when the user visits a non-local notice's url
authorCraig Andrews <candrews@integralblue.com>
Fri, 7 Aug 2009 22:26:12 +0000 (18:26 -0400)
committerCraig Andrews <candrews@integralblue.com>
Fri, 7 Aug 2009 22:26:12 +0000 (18:26 -0400)
Use consistent logic in display non-local notice links

Fixes http://laconi.ca/trac/ticket/1788

actions/shownotice.php
lib/noticelist.php

index 8f73dc824af6d6180fab885c571b7c265d8ebf0e..4b179bc72b3eb94b9422a9ae1e135c1fde508b46 100644 (file)
@@ -97,8 +97,8 @@ class ShownoticeAction extends OwnerDesignAction
 
         $this->user = User::staticGet('id', $this->profile->id);
 
-        if (empty($this->user)) {
-            $this->serverError(_('Not a local notice'), 500);
+        if (! $this->notice->is_local) {
+            common_redirect($this->notice->uri);
             return false;
         }
 
index a8d5059ca49bb443c17c21caf93c6fe02af8e150..5429d943f14b8039977d62aa2d44d0506855305b 100644 (file)
@@ -350,11 +350,10 @@ class NoticeListItem extends Widget
 
     function showNoticeLink()
     {
-        $noticeurl = common_local_url('shownotice',
+        if($this->notice->is_local){
+            $noticeurl = common_local_url('shownotice',
                                       array('notice' => $this->notice->id));
-        // XXX: we need to figure this out better. Is this right?
-        if (strcmp($this->notice->uri, $noticeurl) != 0 &&
-            preg_match('/^http/', $this->notice->uri)) {
+        }else{
             $noticeurl = $this->notice->uri;
         }
         $this->out->elementStart('a', array('rel' => 'bookmark',