aboutsummaryrefslogtreecommitdiff
path: root/modules/fediverse/ap_utils.py
diff options
context:
space:
mode:
authorGravatar jesopo2019-11-27 15:16:46 +0000
committerGravatar jesopo2019-11-27 15:16:46 +0000
commitf62fc8c2a1722454dccc628f495b856daa109fc1 (patch)
tree81185b8cbba55853454e4f894ea3fbc7154c1763 /modules/fediverse/ap_utils.py
parentmake !channels PM-only (diff)
show username when a toot is CWed
Diffstat (limited to 'modules/fediverse/ap_utils.py')
-rw-r--r--modules/fediverse/ap_utils.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/modules/fediverse/ap_utils.py b/modules/fediverse/ap_utils.py
index 686b8850..3f5b6312 100644
--- a/modules/fediverse/ap_utils.py
+++ b/modules/fediverse/ap_utils.py
@@ -123,7 +123,7 @@ def _content(note):
return "<%s>" % filename
-def format_note(actor, note, type="Create"):
+def parse_note(actor, note, type="Create"):
if type == "Announce":
retoot_url = note
retoot_instance = urllib.parse.urlparse(retoot_url).hostname
@@ -135,14 +135,15 @@ def format_note(actor, note, type="Create"):
retooted_user = "@%s@%s" % (original_tooter.username, retoot_instance)
retoot_content = _content(retoot)
- return (retoot.get("summary", None), "%s (boost %s): %s" % (
- actor.username, retooted_user, retoot_content), retoot_url)
+ author = "%s (boost %s)" % (actor.username, retooted_user)
+
+ return (retoot.get("summary", None), author, retoot_content, retoot_url)
+
elif type == "Create":
content = _content(note)
url = note.get("url", note["id"])
- return (note.get("summary", None),
- "%s: %s" % (actor.username, content), url)
+ return note.get("summary", None), actor.username, content, url
- return None, None, None
+ return None