use fediverse display names when available
This commit is contained in:
parent
cffbcad430
commit
3848d878a4
2 changed files with 6 additions and 3 deletions
|
@ -7,6 +7,7 @@ class Actor(object):
|
|||
self.url = url
|
||||
|
||||
self.username = None
|
||||
self.display_name = None
|
||||
self.inbox = None
|
||||
self.outbox = None
|
||||
self.followers = None
|
||||
|
@ -16,6 +17,7 @@ class Actor(object):
|
|||
if response.code == 200:
|
||||
response = response.json()
|
||||
self.username = response["preferredUsername"]
|
||||
self.display_name = response.get("name", self.username)
|
||||
self.inbox = Inbox(response["inbox"])
|
||||
self.outbox = Outbox(response["outbox"])
|
||||
self.followers = response["followers"]
|
||||
|
|
|
@ -132,10 +132,11 @@ def parse_note(actor, note, type="Create"):
|
|||
|
||||
original_tooter = ap_actor.Actor(retoot["attributedTo"])
|
||||
original_tooter.load()
|
||||
retooted_user = "@%s@%s" % (original_tooter.username, retoot_instance)
|
||||
retooted_user = "@%s@%s" % (original_tooter.display_name,
|
||||
retoot_instance)
|
||||
retoot_content = _content(retoot)
|
||||
|
||||
author = "%s (boost %s)" % (actor.username, retooted_user)
|
||||
author = "%s (boost %s)" % (actor.display_name, retooted_user)
|
||||
|
||||
return (retoot.get("summary", None), author, retoot_content, retoot_url)
|
||||
|
||||
|
@ -144,6 +145,6 @@ def parse_note(actor, note, type="Create"):
|
|||
content = _content(note)
|
||||
url = note.get("url", note["id"])
|
||||
|
||||
return note.get("summary", None), actor.username, content, url
|
||||
return note.get("summary", None), actor.display_name, content, url
|
||||
|
||||
return None
|
||||
|
|
Loading…
Reference in a new issue