From 44a635b708fb386fdccf0891c3f1f7be3b801e8a Mon Sep 17 00:00:00 2001 From: jesopo Date: Tue, 8 Oct 2019 16:07:35 +0100 Subject: prefer `url` over `id` as it's usually a more user-friendly url --- modules/fediverse/ap_utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/fediverse/ap_utils.py b/modules/fediverse/ap_utils.py index dabf4f01..91e1be84 100644 --- a/modules/fediverse/ap_utils.py +++ b/modules/fediverse/ap_utils.py @@ -61,6 +61,7 @@ def format_note(actor, note, type="Create"): retoot_url = note retoot_instance = urllib.parse.urlparse(retoot_url).hostname retoot = activity_request(retoot_url) + retoot_url = retoot.data.get("url", retoot.data["id"]) original_tooter = ap_actor.Actor(retoot.data["attributedTo"]) original_tooter.load() @@ -72,7 +73,7 @@ def format_note(actor, note, type="Create"): elif type == "Create": content = utils.http.strip_html(note["content"]) - url = note["id"] + url = note.get("url", note["id"]) return (note.get("summary", None), "%s: %s" % (actor.username, content), url) -- cgit v1.3.1-10-gc9f91