]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/shownotice.php
Fix for error output on invalid user ID to api groups list
[quix0rs-gnu-social.git] / actions / shownotice.php
index 41408c23ccb4a396d92d814366824a5871475ae5..a23027f7c5f6858f308008c647c9e21fe576691e 100644 (file)
@@ -103,11 +103,6 @@ class ShownoticeAction extends OwnerDesignAction
 
         $this->user = User::staticGet('id', $this->profile->id);
 
-        if (! $this->notice->is_local) {
-            common_redirect($this->notice->uri);
-            return false;
-        }
-
         $this->avatar = $this->profile->getAvatar(AVATAR_PROFILE_SIZE);
 
         return true;
@@ -172,9 +167,9 @@ class ShownoticeAction extends OwnerDesignAction
     function title()
     {
         if (!empty($this->profile->fullname)) {
-            $base = $this->profile->fullname . ' (' . $this->user->nickname . ') ';
+            $base = $this->profile->fullname . ' (' . $this->profile->nickname . ') ';
         } else {
-            $base = $this->user->nickname;
+            $base = $this->profile->nickname;
         }
 
         return sprintf(_('%1$s\'s status on %2$s'),
@@ -198,13 +193,20 @@ class ShownoticeAction extends OwnerDesignAction
 
         if ($this->notice->is_local == Notice::REMOTE_OMB) {
             if (!empty($this->notice->url)) {
-                common_redirect($this->notice->url, 301);
+                $target = $this->notice->url;
             } else if (!empty($this->notice->uri) && preg_match('/^https?:/', $this->notice->uri)) {
-                common_redirect($this->notice->uri, 301);
+                // Old OMB posts saved the remote URL only into the URI field.
+                $target = $this->notice->uri;
+            } else {
+                // Shouldn't happen.
+                $target = false;
+            }
+            if ($target && $target != $this->selfUrl()) {
+                common_redirect($target, 301);
+                return false;
             }
-        } else {
-            $this->showPage();
         }
+        $this->showPage();
     }
 
     /**