mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-04-05 03:00:15 -04:00
Rename c.allow_styles and repurpose it for convenient overriding.
This enables fine-grained control to un-block CSS without affecting whether it would be displayed based on user settings or context.
This commit is contained in:
@@ -892,15 +892,16 @@ class RedditController(MinimalController):
|
||||
return self.intermediate_redirect("/over18")
|
||||
|
||||
#check whether to allow custom styles
|
||||
c.allow_styles = self.allow_stylesheets
|
||||
c.allow_styles = True
|
||||
c.can_apply_styles = self.allow_stylesheets
|
||||
if g.css_killswitch:
|
||||
c.allow_styles = False
|
||||
c.can_apply_styles = False
|
||||
#if the preference is set and we're not at a cname
|
||||
elif not c.user.pref_show_stylesheets and not c.cname:
|
||||
c.allow_styles = False
|
||||
c.can_apply_styles = False
|
||||
#if the site has a cname, but we're not using it
|
||||
elif c.site.domain and c.site.css_on_cname and not c.cname:
|
||||
c.allow_styles = False
|
||||
c.can_apply_styles = False
|
||||
|
||||
def check_modified(self, thing, action,
|
||||
private=True, max_age=0, must_revalidate=True):
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
<link rel="shorturl" href="http://${thing.shortlink}"/>
|
||||
%endif
|
||||
|
||||
%if c.allow_styles and c.site.stylesheet_contents:
|
||||
%if c.can_apply_styles and c.allow_styles and c.site.stylesheet_contents:
|
||||
<% inline_stylesheet = (
|
||||
len(c.site.stylesheet_contents) < 1024
|
||||
and '<' not in c.site.stylesheet_contents) %>
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
<%
|
||||
header_title = c.site.header_title
|
||||
d = DefaultSR()
|
||||
if c.site.header and c.allow_styles:
|
||||
if c.site.header and c.can_apply_styles and c.allow_styles:
|
||||
header_img = c.site.header
|
||||
header_size = c.site.header_size
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user