Fix header override when stylesheet doesn't exist

With the reddit themes release, the default sr style and header overrides
the subreddit style if there is no stylesheet (even if there is a header).
This change considers a header as being part of the style and won't override
the current sr style for the reason of there being no stylesheet. This header
image can be disabled with the "show this subreddit's theme" toggle.
This commit is contained in:
MelissaCole
2015-04-22 13:40:50 -07:00
parent f9fcd87c28
commit 08485cc107

View File

@@ -370,7 +370,7 @@ class Reddit(Templated):
c.user.pref_enable_default_themes)
# if there is no style or the style is disabled for this subreddit
self.no_sr_styles = (isinstance(c.site, DefaultSR) or
not self.get_subreddit_stylesheet_url(c.site) or
(not self.get_subreddit_stylesheet_url(c.site) and not c.site.header) or
(c.user and not c.user.use_subreddit_style(c.site)))
self.default_theme_sr = DefaultSR()
@@ -1018,7 +1018,8 @@ class SubredditInfoBar(CachedTemplate):
self.sr_style_toggle = False
self.use_subreddit_style = True
if (c.user_is_loggedin and self.sr.stylesheet_url and
if (c.user_is_loggedin and
(self.sr.stylesheet_url or self.sr.header) and
feature.is_enabled('stylesheets_everywhere')):
# defaults to c.user.pref_show_stylesheets if a match doesn't exist
self.sr_style_toggle = True