fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2011-03-28 09:31 am

[dw-free] Trying to view a community entry posted by a suspended user gives improper error

[commit: http://hg.dwscoalition.org/dw-free/rev/883f8f67cb38]

http://bugs.dwscoalition.org/show_bug.cgi?id=3379

Check for suspension first.

Patch by [personal profile] yvi.

Files modified:
  • cgi-bin/LJ/S2/EntryPage.pm
--------------------------------------------------------------------------------
diff -r 656f82e7b129 -r 883f8f67cb38 cgi-bin/LJ/S2/EntryPage.pm
--- a/cgi-bin/LJ/S2/EntryPage.pm	Mon Mar 28 17:28:50 2011 +0800
+++ b/cgi-bin/LJ/S2/EntryPage.pm	Mon Mar 28 17:31:42 2011 +0800
@@ -456,7 +456,19 @@ sub EntryPage_entry
     }
 
     # check using normal rules
-    unless ($entry->visible_to($remote, $canview)) {
+    unless ( $entry->visible_to( $remote, $canview ) ) {
+
+            # check whether the entry is suspended
+            if ( $pu && $pu->is_suspended && ! $viewsome ) {
+                $opts->{suspendeduser} = 1;
+                return;
+            }
+
+            if ( $entry && $entry->is_suspended_for( $remote ) ) {
+                $opts->{suspendedentry} = 1;
+            return;
+            }
+
         # this checks to see why the logged-in user is not allowed to see
         # the given content.
         if (defined $remote) {
@@ -478,16 +490,6 @@ sub EntryPage_entry
         $opts->{internal_redir} = "/protected";
         $r->notes->{journalid} = $entry->journalid;
         $r->notes->{returnto} = $redir;
-        return;
-    }
-
-    if ( $pu && $pu->is_suspended && ! $viewsome ) {
-        $opts->{'suspendeduser'} = 1;
-        return;
-    }
-
-    if ($entry && $entry->is_suspended_for($remote)) {
-        $opts->{'suspendedentry'} = 1;
         return;
     }
 
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org