mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2009-06-12 05:48 pm

[dw-free] Cannot preview styles if user has created a custom style using core 1

[commit: http://hg.dwscoalition.org/dw-free/rev/374d3d6141ad]

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

Fix error with previewing when the user has a custom style based on core1.

Patch by [personal profile] afuna.

Files modified:
  • cgi-bin/LJ/S2Theme.pm
--------------------------------------------------------------------------------
diff -r 47d20be3e6da -r 374d3d6141ad cgi-bin/LJ/S2Theme.pm
--- a/cgi-bin/LJ/S2Theme.pm	Fri Jun 12 14:47:33 2009 +0000
+++ b/cgi-bin/LJ/S2Theme.pm	Fri Jun 12 17:48:19 2009 +0000
@@ -614,9 +614,14 @@ sub get_preview_styleid {
     my %style = LJ::S2::get_style($u);
     my $i18n_layer = $self->get_custom_i18n_layer_for_theme($u);
     my $user_layer = $self->get_custom_user_layer_for_theme($u);
+    
+    # for the i18nc layer, match the user's preferences if they're not switching cores
+    # if they are switching cores, we don't know what the equivalent should be
+    my $i18nc_layer = ( $self->coreid == $style{core} ) ? $style{i18nc} : undef;
+    
     my %layers = (
-        core   => $style{core},
-        i18nc  => $style{i18nc},
+        core   => $self->coreid,
+        i18nc  => $i18nc_layer,
         layout => $self->layoutid,
         i18n   => $i18n_layer,
         theme  => $self->themeid,
--------------------------------------------------------------------------------