fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2011-10-31 12:04 pm

[dw-free] Revamp /update

[commit: http://hg.dwscoalition.org/dw-free/rev/0c2da8bf43e8]

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

Add all missing panels to the last column (just in case).

Patch by [personal profile] fu.

Files modified:
  • cgi-bin/LJ/User.pm
--------------------------------------------------------------------------------
diff -r 7e25481481b4 -r 0c2da8bf43e8 cgi-bin/LJ/User.pm
--- a/cgi-bin/LJ/User.pm	Mon Oct 31 18:17:03 2011 +0800
+++ b/cgi-bin/LJ/User.pm	Mon Oct 31 20:04:45 2011 +0800
@@ -4796,7 +4796,7 @@
     }
 
     my $prop = $u->prop( "entryform_panels" );
-    return $prop ? Storable::thaw( $prop ) : {
+    my $default = {
         order => [ [ "tags", "displaydate" ],
 
                    # FIXME: should be [ "status"  "journal" "comments" "age_restriction" ] %]
@@ -4822,6 +4822,32 @@
         collapsed => {
         }
     };
+
+    my %need_panels = map { $_ => 1 } keys %{$default->{show}};
+
+    my $ret;
+    $ret = Storable::thaw( $prop ) if $prop;
+
+    if ( $ret ) {
+        # fill in any modules that somehow are not in this list
+        foreach my $column ( @{$ret->{order}} ) {
+            foreach my $panel ( @{$column} ) {
+                delete $need_panels{$panel};
+            }
+        }
+
+        my @col = @{$ret->{order}->[2]};
+        foreach ( keys %need_panels ) {
+            # add back into last column, but don't show
+            push @col, $_;
+            $ret->{show}->{$_} = 0;
+        }
+        $ret->{order}->[2] = \@col;
+    } else {
+        $ret = $default;
+    }
+
+    return $ret;
 }
 
 sub entryform_panels_order {
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
No Subject Icon Selected
More info about formatting

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