mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-04-27 03:00:12 -04:00
Add timeouts and locked post templates consistently
This commit is contained in:
@@ -51,6 +51,7 @@ api('subreddit', SubredditJsonTemplate)
|
||||
api('labeledmulti', LabeledMultiJsonTemplate)
|
||||
api('reddit', RedditJsonTemplate)
|
||||
api('panestack', PanestackJsonTemplate)
|
||||
api('htmlpanestack', NullJsonTemplate)
|
||||
api('listing', ListingJsonTemplate)
|
||||
api('searchlisting', SearchListingJsonTemplate)
|
||||
api('userlisting', UserListingJsonTemplate)
|
||||
|
||||
@@ -408,6 +408,13 @@ class Reddit(Templated):
|
||||
if c.user_is_sponsor:
|
||||
panes.append(FraudForm())
|
||||
|
||||
if c.user_is_loggedin and c.user.in_timeout:
|
||||
self.show_timeout_modal = True
|
||||
self.timeout_days_remaining = c.user.days_remaining_in_timeout
|
||||
|
||||
self.popup_panes = self.build_popup_panes()
|
||||
panes.append(self.popup_panes)
|
||||
|
||||
self._content = PaneStack(panes)
|
||||
|
||||
self.show_chooser = (
|
||||
@@ -422,10 +429,6 @@ class Reddit(Templated):
|
||||
|
||||
self.toolbars = self.build_toolbars()
|
||||
|
||||
if c.user_is_loggedin and c.user.in_timeout:
|
||||
self.show_timeout_modal = True
|
||||
self.timeout_days_remaining = c.user.days_remaining_in_timeout
|
||||
|
||||
has_style_override = (c.user_is_loggedin and
|
||||
c.user.pref_default_theme_sr and
|
||||
feature.is_enabled('stylesheets_everywhere') and
|
||||
@@ -994,6 +997,18 @@ class Reddit(Templated):
|
||||
self._content,
|
||||
))
|
||||
|
||||
def build_popup_panes(self):
|
||||
panes = []
|
||||
|
||||
if self.show_timeout_modal:
|
||||
popup_content = InTimeoutInterstitial(
|
||||
timeout_days_remaining=self.timeout_days_remaining,
|
||||
hide_message=True,
|
||||
)
|
||||
panes.append(Popup('access-popup', popup_content))
|
||||
|
||||
return HtmlPaneStack(panes)
|
||||
|
||||
def is_gold_page(self):
|
||||
return "gold-page-ga-tracking" in self.supplied_page_classes
|
||||
|
||||
@@ -1862,8 +1877,7 @@ class LinkInfoPage(Reddit):
|
||||
comment_area = InfoBar(message=_("comments disabled"))
|
||||
else:
|
||||
panes = [self.nav_menu, self._content]
|
||||
if self.link.locked:
|
||||
panes.append(Popup('locked-popup', LockedInterstitial()))
|
||||
|
||||
comment_area = PaneStack([
|
||||
PaneStack(
|
||||
panes
|
||||
@@ -1873,9 +1887,21 @@ class LinkInfoPage(Reddit):
|
||||
css_class="commentarea",
|
||||
)
|
||||
|
||||
return self.content_stack(
|
||||
(self.infobar, self.link_listing, comment_area)
|
||||
)
|
||||
return self.content_stack((
|
||||
self.infobar,
|
||||
self.link_listing,
|
||||
comment_area,
|
||||
self.popup_panes,
|
||||
))
|
||||
|
||||
def build_popup_panes(self):
|
||||
panes = super(LinkInfoPage, self).build_popup_panes()
|
||||
|
||||
if self.link.locked:
|
||||
panes.append(Popup('locked-popup', LockedInterstitial()))
|
||||
|
||||
return panes
|
||||
|
||||
|
||||
def rightbox(self):
|
||||
rb = Reddit.rightbox(self)
|
||||
@@ -3449,6 +3475,11 @@ class PaneStack(Templated):
|
||||
return self.stack.insert(*a)
|
||||
|
||||
|
||||
class HtmlPaneStack(PaneStack):
|
||||
"""Same as panestack, but won't show up in json responses."""
|
||||
pass
|
||||
|
||||
|
||||
class SearchForm(Templated):
|
||||
"""The simple search form in the header of the page. prev_search
|
||||
is the previous search."""
|
||||
|
||||
@@ -171,12 +171,6 @@
|
||||
<%include file="prefoptions.html" />
|
||||
</script>
|
||||
%endif
|
||||
%if thing.show_timeout_modal:
|
||||
<script id="access-popup" type="text/template">
|
||||
${InTimeoutInterstitial(timeout_days_remaining=thing.timeout_days_remaining,
|
||||
hide_message=True)}
|
||||
</script>
|
||||
%endif
|
||||
% if c.secure:
|
||||
## Pixel to pick up HSTS policies from the base domain
|
||||
<img id="hsts_pixel" src="//${g.domain}/static/pixel.png">
|
||||
|
||||
Reference in New Issue
Block a user