[livejournal] r23474: LJSUP-14608: If user applied style then ...
Committer: wisest-owl
LJSUP-14608: If user applied style then changing it's name don't affect current theme in settingsU trunk/cgi-bin/LJ/S2Theme.pm U trunk/cgi-bin/LJ/Widget/CurrentTheme.pm U trunk/cgi-bin/LJ/Widget/ThemeChooser.pm
Modified: trunk/cgi-bin/LJ/S2Theme.pm
===================================================================
--- trunk/cgi-bin/LJ/S2Theme.pm 2012-12-14 13:09:09 UTC (rev 23473)
+++ trunk/cgi-bin/LJ/S2Theme.pm 2012-12-14 13:41:18 UTC (rev 23474)
@@ -448,8 +448,6 @@
$layout_class = "LJ::S2Theme::$layout_class";
# make this theme an object of the lowest level class that's defined
-# if ($layers->{$themeid}->{'is_buyable'} || $outhash{$themeid}{'is_buyable'}) {
-# bless $self, "LJ::S2Theme::LJShopStyle";
if (eval { $theme_class->init }) {
bless $self, $theme_class;
} elsif (eval { $layout_class->init }) {
@@ -489,6 +487,11 @@
sub name {
my $self = shift;
+ if ($self->is_buyable) {
+ my $shop_theme = LJ::Pay::Theme->load_by_s2lid ($self->s2lid);
+ return $shop_theme->name;
+ }
+
return $self->{name};
}
Modified: trunk/cgi-bin/LJ/Widget/CurrentTheme.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/CurrentTheme.pm 2012-12-14 13:09:09 UTC (rev 23473)
+++ trunk/cgi-bin/LJ/Widget/CurrentTheme.pm 2012-12-14 13:41:18 UTC (rev 23474)
@@ -35,14 +35,7 @@
$ret .= "<h2 class='widget-header'><span>" . $class->ml('widget.currenttheme.title', {'user' => $u->ljuser_display}) . "</span></h2>";
$ret .= "<div class='theme-current-content pkg'>";
$ret .= "<img src='" . $theme->preview_imgurl . "' class='theme-current-image' />";
- my $theme_name = '';
- my $theme_shop = LJ::Pay::Theme->load_by_s2lid ($theme->s2lid);
- if ($theme_shop) {
- $theme_name = $theme_shop->name;
- } else {
- $theme_name = $theme->name;
- }
- $ret .= "<h3>" . $theme_name . "</h3>";
+ $ret .= "<h3>" . $theme->name . "</h3>";
my $layout_link = "<a href='$LJ::SITEROOT/customize/$getextra${getsep}layoutid=" . $theme->layoutid . "$filterarg$showarg' class='theme-current-layout'><em>$layout_name</em></a>";
my $special_link_opts = "href='$LJ::SITEROOT/customize/$getextra${getsep}cat=special$filterarg$showarg' class='theme-current-cat'";
Modified: trunk/cgi-bin/LJ/Widget/ThemeChooser.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/ThemeChooser.pm 2012-12-14 13:09:09 UTC (rev 23473)
+++ trunk/cgi-bin/LJ/Widget/ThemeChooser.pm 2012-12-14 13:41:18 UTC (rev 23474)
@@ -191,7 +191,7 @@
$ret .= "<div class='theme-item$theme_class'><div class='theme-item-in'>";
$ret .= "<img src='" . $theme->preview_imgurl . "' class='theme-preview' alt='' />";
- $ret .= "<h4>" . ( $theme->is_buyable ? $shop_theme->name : $theme->name ) . "</h4>";
+ $ret .= "<h4>" . $theme->name . "</h4>";
my $preview_redirect_url;
if ($theme->themeid) {
