diff --git a/r2/r2/controllers/post.py b/r2/r2/controllers/post.py index 408677b6f..c4cd0f8df 100644 --- a/r2/r2/controllers/post.py +++ b/r2/r2/controllers/post.py @@ -91,6 +91,7 @@ class PostController(ApiController): default = g.num_comments), pref_show_stylesheets = VBoolean('show_stylesheets'), pref_show_flair = VBoolean('show_flair'), + pref_show_link_flair = VBoolean('show_link_flair'), pref_no_profanity = VBoolean('no_profanity'), pref_label_nsfw = VBoolean('label_nsfw'), pref_show_promote = VBoolean('show_promote'), diff --git a/r2/r2/lib/pages/pages.py b/r2/r2/lib/pages/pages.py index 98cced933..6f2491a78 100755 --- a/r2/r2/lib/pages/pages.py +++ b/r2/r2/lib/pages/pages.py @@ -975,7 +975,8 @@ class CommentPane(Templated): return "_".join(map(str, ["commentpane", self.article._fullname, num, self.sort, self.num, c.lang, self.can_reply, c.render_style, - c.user.pref_show_flair])) + c.user.pref_show_flair, + c.user.pref_show_link_flair])) def __init__(self, article, sort, comment, context, num, **kw): # keys: lang, num, can_reply, render_style @@ -1028,8 +1029,9 @@ class CommentPane(Templated): logged_in = c.user_is_loggedin try: c.user = UnloggedUser([c.lang]) - # Preserve the viewing user's flair preference. + # Preserve the viewing user's flair preferences. c.user.pref_show_flair = user.pref_show_flair + c.user.pref_show_link_flair = user.pref_show_link_flair c.user_is_loggedin = False # render as if not logged in (but possibly with reply buttons) diff --git a/r2/r2/lib/wrapped.pyx b/r2/r2/lib/wrapped.pyx index b8b23f1dd..50ee9d976 100644 --- a/r2/r2/lib/wrapped.pyx +++ b/r2/r2/lib/wrapped.pyx @@ -466,7 +466,7 @@ class CachedTemplate(Templated): c.site.flair_enabled, c.site.flair_position, c.site.link_flair_position, c.user.flair_enabled_in_sr(c.site._id), - c.user.pref_show_flair]) + c.user.pref_show_flair, c.user.pref_show_link_flair]) keys = [make_cachable(x, *a) for x in keys] # add all parameters sent into __init__, using their current value diff --git a/r2/r2/models/account.py b/r2/r2/models/account.py index 24a1435d6..cd6b4fff7 100644 --- a/r2/r2/models/account.py +++ b/r2/r2/models/account.py @@ -74,6 +74,7 @@ class Account(Thing): pref_label_nsfw = True, pref_show_stylesheets = True, pref_show_flair = True, + pref_show_link_flair = True, pref_mark_messages_read = True, pref_threaded_messages = True, pref_collapse_read_messages = False, diff --git a/r2/r2/templates/link.compact b/r2/r2/templates/link.compact index 0fb0236c7..e1d344c2f 100644 --- a/r2/r2/templates/link.compact +++ b/r2/r2/templates/link.compact @@ -32,6 +32,12 @@ <%namespace file="utils.compact" import="icon_button, toggle_button" /> <%namespace file="printablebuttons.html" import="state_button" /> +<%def name="flair()"> + %if c.user.pref_show_link_flair: + ${thing.flair_text} + %endif +%def> +
${thing.title}
%if c.site.link_flair_position == 'right' and thing.flair_text:
- ${thing.flair_text}
+ ${flair()}
%endif
%if thing.is_self:
diff --git a/r2/r2/templates/link.html b/r2/r2/templates/link.html
index b9433ffd9..67ae2f2e6 100644
--- a/r2/r2/templates/link.html
+++ b/r2/r2/templates/link.html
@@ -79,7 +79,7 @@
%def>
<%def name="flair()">
- %if thing.flair_text or thing.flair_css_class:
+ %if c.user.pref_show_link_flair and (thing.flair_text or thing.flair_css_class):
## TODO: clean this up
${thing.flair_text}
diff --git a/r2/r2/templates/link.htmllite b/r2/r2/templates/link.htmllite
index 193907901..95f43bfdf 100644
--- a/r2/r2/templates/link.htmllite
+++ b/r2/r2/templates/link.htmllite
@@ -28,10 +28,12 @@
<%inherit file="printable.htmllite" />
<%def name="flair()">
-
- ${thing.flair_text}
-
+ %if c.user.pref_show_link_flair:
+
+ ${thing.flair_text}
+
+ %endif
%def>
<%def name="entry()">
diff --git a/r2/r2/templates/link.mobile b/r2/r2/templates/link.mobile
index 9ce8ffc21..5b234b082 100644
--- a/r2/r2/templates/link.mobile
+++ b/r2/r2/templates/link.mobile
@@ -28,6 +28,12 @@
<%namespace file="utils.html" import="plain_link" />
<%inherit file="printable.mobile" />
+<%def name="flair()">
+ %if c.user.pref_show_link_flair:
+ ${thing.flair_text}
+ %endif
+%def>
+
<%def name="entry()">
<%
if thing.num_comments:
@@ -41,7 +47,7 @@
%>