diff options
| author | 2019-10-04 13:06:29 +0100 | |
|---|---|---|
| committer | 2019-10-04 13:06:29 +0100 | |
| commit | 472b5ba9f0f8d04fb65140b5ed66ac0044753765 (patch) | |
| tree | 756180de52ab1f20638b58c3db2fbb8a807314c9 /modules/fediverse/ap_utils.py | |
| parent | expand `apikey` command to list, add, remove and info (diff) | |
support !fedi with a URL to a Note
Diffstat (limited to 'modules/fediverse/ap_utils.py')
| -rw-r--r-- | modules/fediverse/ap_utils.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/modules/fediverse/ap_utils.py b/modules/fediverse/ap_utils.py index cd229f15..dabf4f01 100644 --- a/modules/fediverse/ap_utils.py +++ b/modules/fediverse/ap_utils.py @@ -56,9 +56,9 @@ def find_actor(username, instance): if link["type"] == ACTIVITY_TYPE: return link["href"] -def format_note(actor, note): - if note["type"] == "Announce": - retoot_url = note["object"] +def format_note(actor, note, type="Create"): + if type == "Announce": + retoot_url = note retoot_instance = urllib.parse.urlparse(retoot_url).hostname retoot = activity_request(retoot_url) @@ -70,11 +70,11 @@ def format_note(actor, note): return (retoot.data.get("summary", None), "%s (boost %s): %s - %s" % ( actor.username, retooted_user, retoot_content), retoot_url) - elif note["type"] == "Create": - content = utils.http.strip_html(note["object"]["content"]) - url = note["object"]["id"] + elif type == "Create": + content = utils.http.strip_html(note["content"]) + url = note["id"] - return (note["object"].get("summary", None), + return (note.get("summary", None), "%s: %s" % (actor.username, content), url) return None, None, None |
