mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-26 23:39:11 -05:00
Add a user preference for whether to show flair.
This commit is contained in:
@@ -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'),
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -230,11 +230,13 @@
|
||||
<th>${_("display options")}</th>
|
||||
<td class="prefright">
|
||||
${checkbox(_("allow reddits to show me custom styles"), "show_stylesheets")}
|
||||
%if c.user.pref_show_promote is not None:
|
||||
<br/>
|
||||
${checkbox(_("show promote tab on front page"),
|
||||
"show_promote")}
|
||||
%endif
|
||||
${checkbox(_("show user flair"), "show_flair")}
|
||||
%if c.user.pref_show_promote is not None:
|
||||
<br/>
|
||||
${checkbox(_("show promote tab on front page"),
|
||||
"show_promote")}
|
||||
%endif
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
Reference in New Issue
Block a user