Hide friend label for anonymous messages

People could see who gilded them anonymously by having them as a friend and
including a specific note. This removes friend notes from messages that have a
display_author.
This commit is contained in:
MelissaCole
2015-05-13 13:22:34 -07:00
parent dac71a3597
commit 5ec4d98908

View File

@@ -147,14 +147,20 @@ class Builder(object):
try:
w.author = authors.get(item.author_id)
if user and item.author_id in user.friends:
author_id = item.author_id
# if display_author exists, then author_id is unknown to the
# receiver, so don't display friend relationship details
if hasattr(item, 'display_author') and item.display_author:
author_id = item.display_author
if user and author_id in user.friends:
# deprecated old way:
w.friend = True
# new way:
label = None
if friend_rels:
rel = friend_rels[item.author_id]
rel = friend_rels[author_id]
note = getattr(rel, "note", None)
if note:
label = u"%s (%s)" % (_("friend"),