mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-25 23:08:22 -05:00
Add a user preference for showing link flair.
This commit is contained in:
@@ -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'),
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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:
|
||||
<span class="linkflair">${thing.flair_text}</span>
|
||||
%endif
|
||||
</%def>
|
||||
|
||||
<div class="thing link id-${thing._fullname}">
|
||||
<span class="rank" style="width:${thing.numcolmargin};">
|
||||
${thing.num}
|
||||
@@ -62,7 +68,7 @@
|
||||
url = thing.url
|
||||
%>
|
||||
%if c.site.link_flair_position == 'left' and thing.flair_text:
|
||||
<span class="linkflair">${thing.flair_text}</span>
|
||||
${flair()}
|
||||
%endif
|
||||
%if thing.has_thumbnail and thing.thumbnail:
|
||||
<a href="${url}" class="thumbnail">
|
||||
@@ -72,7 +78,7 @@
|
||||
<p class="title">
|
||||
<a href="${url}">${thing.title}</a>
|
||||
%if c.site.link_flair_position == 'right' and thing.flair_text:
|
||||
<span class="linkflair">${thing.flair_text}</span>
|
||||
${flair()}
|
||||
%endif
|
||||
<span class="domain">
|
||||
%if thing.is_self:
|
||||
|
||||
@@ -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
|
||||
<span class="linkflair ${' '.join('linkflair-' + c for c in thing.flair_css_class.split())}">
|
||||
${thing.flair_text}
|
||||
|
||||
@@ -28,10 +28,12 @@
|
||||
<%inherit file="printable.htmllite" />
|
||||
|
||||
<%def name="flair()">
|
||||
<span class="linkflair"
|
||||
${optionalstyle("color: #545454; background-color: #f5f5f5; border: 1px solid #dedede; display: inline-block; font-size: x-small; margin-right: 0.5em; padding: 0 2px; max-width: 10em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;")}>
|
||||
${thing.flair_text}
|
||||
</span>
|
||||
%if c.user.pref_show_link_flair:
|
||||
<span class="linkflair"
|
||||
${optionalstyle("color: #545454; background-color: #f5f5f5; border: 1px solid #dedede; display: inline-block; font-size: x-small; margin-right: 0.5em; padding: 0 2px; max-width: 10em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;")}>
|
||||
${thing.flair_text}
|
||||
</span>
|
||||
%endif
|
||||
</%def>
|
||||
|
||||
<%def name="entry()">
|
||||
|
||||
@@ -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:
|
||||
<span class="linkflair">${thing.flair_text}</span>
|
||||
%endif
|
||||
</%def>
|
||||
|
||||
<%def name="entry()">
|
||||
<%
|
||||
if thing.num_comments:
|
||||
@@ -41,7 +47,7 @@
|
||||
%>
|
||||
<div class="link">
|
||||
%if c.site.link_flair_position == 'left' and thing.flair_text:
|
||||
<span class="linkflair">${thing.flair_text}</span>
|
||||
${flair()}
|
||||
%endif
|
||||
%if thing.is_self:
|
||||
<a class="title" href="${add_sr(thing.href_url)}">${thing.title}</a>
|
||||
@@ -49,7 +55,7 @@
|
||||
<a class="title" href="${thing.url}">${thing.title}</a>
|
||||
%endif
|
||||
%if c.site.link_flair_position == 'right' and thing.flair_text:
|
||||
<span class="linkflair">${thing.flair_text}</span>
|
||||
${flair()}
|
||||
%endif
|
||||
<p class="byline"> ${thing.score} ${ungettext("point", "points", thing.score)}
|
||||
%if thing.num_comments or thing.is_self:
|
||||
|
||||
@@ -232,6 +232,8 @@
|
||||
${checkbox(_("allow reddits to show me custom styles"), "show_stylesheets")}
|
||||
<br/>
|
||||
${checkbox(_("show user flair"), "show_flair")}
|
||||
<br/>
|
||||
${checkbox(_("show link flair"), "show_link_flair")}
|
||||
%if c.user.pref_show_promote is not None:
|
||||
<br/>
|
||||
${checkbox(_("show promote tab on front page"),
|
||||
|
||||
Reference in New Issue
Block a user