diff --git a/r2/r2/controllers/post.py b/r2/r2/controllers/post.py index 225fe64b9..742b56c60 100644 --- a/r2/r2/controllers/post.py +++ b/r2/r2/controllers/post.py @@ -90,6 +90,7 @@ class PostController(ApiController): pref_num_comments = VInt('num_comments', 1, g.max_comments, default = g.num_comments), pref_show_stylesheets = VBoolean('show_stylesheets'), + pref_show_flair = VBoolean('show_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 c1517fa02..c54dfa488 100644 --- a/r2/r2/lib/pages/pages.py +++ b/r2/r2/lib/pages/pages.py @@ -492,7 +492,7 @@ class SubredditInfoBar(CachedTemplate): # so the menus cache properly self.path = request.path - if c.user_is_loggedin: + if c.user_is_loggedin and c.user.pref_show_flair: self.flair_prefs = FlairPrefs() else: self.flair_prefs = None @@ -891,7 +891,8 @@ class CommentPane(Templated): num = (num / 10) * 10 return "_".join(map(str, ["commentpane", self.article._fullname, num, self.sort, self.num, c.lang, - self.can_reply, c.render_style])) + self.can_reply, c.render_style, + c.user.pref_show_flair])) def __init__(self, article, sort, comment, context, num, **kw): # keys: lang, num, can_reply, render_style @@ -2290,7 +2291,8 @@ class WrappedUser(CachedTemplate): flair = wrapped_flair(user, subreddit or c.site, force_show_flair) flair_enabled, flair_position, flair_text, flair_css_class = flair - has_flair = bool(flair_text or flair_css_class) + has_flair = bool( + c.user.pref_show_flair and (flair_text or flair_css_class)) if flair_template: flair_template_id = flair_template._id diff --git a/r2/r2/lib/wrapped.pyx b/r2/r2/lib/wrapped.pyx index fd60fe103..01c6aab46 100644 --- a/r2/r2/lib/wrapped.pyx +++ b/r2/r2/lib/wrapped.pyx @@ -464,7 +464,8 @@ class CachedTemplate(Templated): if c.user_is_loggedin and hasattr(c.site, '_id'): keys.extend([ c.site.flair_enabled, c.site.flair_position, - c.user.flair_enabled_in_sr(c.site._id)]) + c.user.flair_enabled_in_sr(c.site._id), + c.user.pref_show_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 31003be5b..a20347d7f 100644 --- a/r2/r2/models/account.py +++ b/r2/r2/models/account.py @@ -66,6 +66,7 @@ class Account(Thing): pref_no_profanity = True, pref_label_nsfw = True, pref_show_stylesheets = True, + pref_show_flair = True, pref_mark_messages_read = True, pref_threaded_messages = True, pref_collapse_read_messages = False, diff --git a/r2/r2/templates/prefoptions.html b/r2/r2/templates/prefoptions.html index 26bd16390..2edc49e98 100644 --- a/r2/r2/templates/prefoptions.html +++ b/r2/r2/templates/prefoptions.html @@ -230,11 +230,13 @@