mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-14 09:27:57 -05:00
Quarantine: Move feature flag checks out of templates.
This commit is contained in:
@@ -1046,6 +1046,8 @@ class SubredditInfoBar(CachedTemplate):
|
||||
self.sr_style_toggle = False
|
||||
self.use_subreddit_style = True
|
||||
|
||||
self.quarantine_enabled = feature.is_enabled('quarantine')
|
||||
|
||||
if (c.user_is_loggedin and
|
||||
(self.sr.stylesheet_url or self.sr.header) and
|
||||
feature.is_enabled('stylesheets_everywhere')):
|
||||
@@ -2252,6 +2254,7 @@ class SidebarModList(Templated):
|
||||
# primary sort is desc. subscribers, secondary is name
|
||||
self.subreddits = sorted(subreddits,
|
||||
key=lambda sr: (-sr._ups, sr.name.lower()))
|
||||
self.quarantine_enabled = feature.is_enabled('quarantine')
|
||||
|
||||
|
||||
class ProfileBar(Templated):
|
||||
|
||||
@@ -501,7 +501,8 @@ class Link(Thing, Printable):
|
||||
item.nsfw_str)
|
||||
item.nsfw = item.over_18 and user.pref_label_nsfw
|
||||
|
||||
item.quarantine = item.subreddit.quarantine
|
||||
item.quarantine_enabled = feature.is_enabled('quarantine')
|
||||
item.quarantine = item.quarantine_enabled and item.subreddit.quarantine
|
||||
|
||||
item.show_new_post_sharing = feature.is_enabled('improved_sharing')
|
||||
|
||||
@@ -1296,6 +1297,8 @@ class Comment(Thing, Printable):
|
||||
item.profilepage = c.profilepage
|
||||
item.link = links.get(item.link_id)
|
||||
|
||||
item.quarantine_enabled = feature.is_enabled('quarantine')
|
||||
|
||||
if (item.link._score <= 1 or item.score < 3 or
|
||||
item.link._spam or item._spam or item.author._spam):
|
||||
item.nofollow = True
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
${thing.link.url}
|
||||
%endif
|
||||
%endif
|
||||
%if feature.is_enabled('quarantine'):
|
||||
%if thing.quarantine_enabled:
|
||||
%if thing.subreddit.quarantine:
|
||||
<span class="quarantine-warning">
|
||||
${quarantine_stamp()}
|
||||
|
||||
@@ -146,7 +146,7 @@ ${parent.midcol(cls = cls)}
|
||||
</%def>
|
||||
|
||||
<%def name="buttons()">
|
||||
%if c.profilepage and feature.is_enabled('quarantine'):
|
||||
%if c.profilepage and thing.quarantine_enabled:
|
||||
%if thing.subreddit.quarantine:
|
||||
<li class="rounded quarantine-stamp stamp bold-stamp">
|
||||
${quarantine_stamp()}
|
||||
|
||||
@@ -69,9 +69,9 @@
|
||||
<%def name="bottom_buttons()">
|
||||
<ul class="flat-list buttons">
|
||||
<%
|
||||
stamp_style = 'bold-stamp' if feature.is_enabled('quarantine') else ''
|
||||
stamp_style = 'bold-stamp' if thing.quarantine_enabled else ''
|
||||
%>
|
||||
%if thing.quarantine and feature.is_enabled('quarantine'):
|
||||
%if thing.quarantine_enabled and thing.quarantine:
|
||||
<li class="rounded quarantine-stamp stamp ${stamp_style}">
|
||||
${quarantine_stamp()}
|
||||
</li>
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
%for sr in thing.subreddits:
|
||||
<li>
|
||||
<a href="${sr.path}" title="/r/${sr.name}">/r/${sr.name}</a>
|
||||
%if feature.is_enabled('quarantine'):
|
||||
%if thing.quarantine_enabled:
|
||||
%if sr.quarantine:
|
||||
<span class="rounded quarantine-stamp stamp bold-stamp">
|
||||
${quarantine_stamp()}
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
${plain_link(thing.sr.name, thing.sr.path, _sr_path=False, _class="hover")}
|
||||
</h1>
|
||||
|
||||
%if thing.sr.quarantine and feature.is_enabled('quarantine'):
|
||||
%if thing.sr.quarantine and thing.quarantine_enabled:
|
||||
<div class="quarantine-notice">
|
||||
<div class="md-container">
|
||||
${_md("This community is quarantined because of its distasteful and highly offensive content.", wrap=True)}
|
||||
|
||||
Reference in New Issue
Block a user