mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-28 16:28:01 -05:00
Add approval checkmark to comments as well
This commit is contained in:
@@ -267,6 +267,26 @@ class Builder(object):
|
||||
and item.sr_id in can_own_flair_set)))):
|
||||
w.can_flair = True
|
||||
|
||||
w.approval_checkmark = None
|
||||
if w.can_ban:
|
||||
verdict = getattr(w, "verdict", None)
|
||||
if verdict in ('admin-approved', 'mod-approved'):
|
||||
approver = None
|
||||
baninfo = getattr(w, "ban_info", None)
|
||||
if baninfo:
|
||||
approver = baninfo.get("unbanner", None)
|
||||
approval_time = baninfo.get("unbanned_at", None)
|
||||
|
||||
approver = approver or _("a moderator")
|
||||
|
||||
if approval_time:
|
||||
text = _("approved by %(who)s %(when)s ago") % {
|
||||
"who": approver,
|
||||
"when": timesince(approval_time)}
|
||||
else:
|
||||
text = _("approved by %s") % approver
|
||||
w.approval_checkmark = text
|
||||
|
||||
# recache the user object: it may be None if user is not logged in,
|
||||
# whereas now we are happy to have the UnloggedUser object
|
||||
user = c.user
|
||||
|
||||
@@ -542,33 +542,12 @@ class Link(Thing, Printable):
|
||||
item.author = DeletedUser()
|
||||
item.as_deleted = True
|
||||
|
||||
item.approval_checkmark = None
|
||||
|
||||
item_age = datetime.now(g.tz) - item._date
|
||||
if item_age.days > g.VOTE_AGE_LIMIT and item.promoted is None:
|
||||
item.votable = False
|
||||
else:
|
||||
item.votable = True
|
||||
|
||||
if item.can_ban:
|
||||
verdict = getattr(item, "verdict", None)
|
||||
if verdict in ('admin-approved', 'mod-approved'):
|
||||
approver = None
|
||||
baninfo = getattr(item, "ban_info", None)
|
||||
if baninfo:
|
||||
approver = baninfo.get("unbanner", None)
|
||||
approval_time = baninfo.get("unbanned_at", None)
|
||||
|
||||
approver = approver or _("a moderator")
|
||||
|
||||
if approval_time:
|
||||
text = _("approved by %(who)s %(when)s ago") % {
|
||||
"who": approver,
|
||||
"when": timesince(approval_time)}
|
||||
else:
|
||||
text = _("approved by %s") % approver
|
||||
item.approval_checkmark = text
|
||||
|
||||
item.expunged = False
|
||||
if item.is_self:
|
||||
item.expunged = Link._should_expunge_selftext(item)
|
||||
|
||||
@@ -3323,6 +3323,10 @@ form input[type=radio] {margin: 2px .5em 0 0; }
|
||||
margin-left: 3px;
|
||||
}
|
||||
|
||||
.tagline .approval-checkmark {
|
||||
height: 1em;
|
||||
}
|
||||
|
||||
.little { font-size: smaller }
|
||||
.gray { color: gray }
|
||||
|
||||
|
||||
@@ -137,6 +137,7 @@ ${parent.collapsed()}
|
||||
${ungettext("child", "children", thing.num_children)})
|
||||
</a>
|
||||
%endif
|
||||
${self.approval_checkmark()}
|
||||
</%def>
|
||||
|
||||
<%def name="Child()">
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
from r2.lib.template_helpers import s3_https_if_secure
|
||||
from r2.lib.pages.things import LinkButtons
|
||||
from r2.lib.pages import WrappedUser
|
||||
from r2.lib.template_helpers import static
|
||||
from r2.lib.strings import Score, strings
|
||||
%>
|
||||
|
||||
@@ -93,13 +92,7 @@
|
||||
%if c.site.link_flair_position == 'right':
|
||||
<%call expr="flair()" />
|
||||
%endif
|
||||
%if getattr(thing, "approval_checkmark", None):
|
||||
<img class="approval-checkmark" title="${thing.approval_checkmark}"
|
||||
src="${static('green-check.png')}"
|
||||
onclick="alert('${thing.approval_checkmark}\n\n' +
|
||||
'${_("(no need to click for this info; just hover over the checkmark next time)")}')"
|
||||
/>
|
||||
%endif
|
||||
${self.approval_checkmark()}
|
||||
 
|
||||
|
||||
${self.domain()}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
###############################################################################
|
||||
|
||||
<%!
|
||||
from r2.lib.template_helpers import add_sr
|
||||
from r2.lib.template_helpers import add_sr, static
|
||||
from r2.lib.strings import strings
|
||||
from r2.lib.pages.things import BanButtons
|
||||
%>
|
||||
@@ -45,6 +45,15 @@ ${self.RenderPrintable()}
|
||||
%endif
|
||||
</%def>
|
||||
|
||||
<%def name="approval_checkmark()">
|
||||
%if getattr(thing, "approval_checkmark", None):
|
||||
<img class="approval-checkmark" title="${thing.approval_checkmark}"
|
||||
src="${static('green-check.png')}"
|
||||
onclick="alert('${thing.approval_checkmark}\n\n${_("(no need to click for this info; just hover over the checkmark next time)")}')"
|
||||
>
|
||||
%endif
|
||||
</%def>
|
||||
|
||||
<%def name="thing_css_class(what)">thing id-${what._fullname}</%def>
|
||||
|
||||
<%def name="thing_css_rowclass(what)">
|
||||
|
||||
Reference in New Issue
Block a user