mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-28 08:17:58 -05:00
Add indicators of hidden score to API and HTML
If the score is hidden, data-ups and data-downs will both be 0, and the comment will also have the "score-hidden" class
This commit is contained in:
@@ -369,6 +369,7 @@ class PromotedLinkJsonTemplate(LinkJsonTemplate):
|
||||
class CommentJsonTemplate(ThingJsonTemplate):
|
||||
_data_attrs_ = ThingJsonTemplate.data_attrs(ups = "upvotes",
|
||||
downs = "downvotes",
|
||||
score_hidden = "score_hidden",
|
||||
replies = "child",
|
||||
body = "body",
|
||||
body_html = "body_html",
|
||||
|
||||
@@ -1057,6 +1057,7 @@ class Comment(Thing, Printable):
|
||||
item.score = 1
|
||||
item.score_hidden = True
|
||||
item.voting_score = [1, 1, 1]
|
||||
item.render_css_class += " score-hidden"
|
||||
else:
|
||||
item.score_hidden = False
|
||||
|
||||
|
||||
@@ -34,7 +34,11 @@
|
||||
##################
|
||||
|
||||
<%def name="thing_data_attributes(what)" buffered="True">
|
||||
${parent.thing_data_attributes(what)} data-ups="${what.upvotes}" data-downs="${what.downvotes}"
|
||||
%if what.score_hidden:
|
||||
${parent.thing_data_attributes(what)} data-ups="0" data-downs="0"
|
||||
%else:
|
||||
${parent.thing_data_attributes(what)} data-ups="${what.upvotes}" data-downs="${what.downvotes}"
|
||||
%endif
|
||||
</%def>
|
||||
|
||||
<%def name="midcol(display=True, cls = '')">
|
||||
|
||||
Reference in New Issue
Block a user