From f739064d10bc6f682d47683c95a95cc1c13fceb4 Mon Sep 17 00:00:00 2001 From: jesopo Date: Tue, 15 Oct 2019 15:13:28 +0100 Subject: [PATCH] show `first` toot if it's a boost, fix Note boost formatting --- modules/fediverse/__init__.py | 3 ++- modules/fediverse/ap_utils.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/fediverse/__init__.py b/modules/fediverse/__init__.py index bbf29110..575f0f6a 100644 --- a/modules/fediverse/__init__.py +++ b/modules/fediverse/__init__.py @@ -111,7 +111,8 @@ class Module(ModuleManager.BaseModule): items = actor.outbox.load() for item in items: - if item["object"].get("inReplyTo", None) == None: + if (item["type"] == "Announce" or + item["object"].get("inReplyTo", None) == None): first_item = item break diff --git a/modules/fediverse/ap_utils.py b/modules/fediverse/ap_utils.py index 10aa0a67..e8f25bbc 100644 --- a/modules/fediverse/ap_utils.py +++ b/modules/fediverse/ap_utils.py @@ -1,6 +1,7 @@ import urllib.parse import bs4 from src import IRCBot, utils +from . import ap_actor LD_TYPE = ("application/ld+json; " "profile=\"https://www.w3.org/ns/activitystreams\"") @@ -93,7 +94,7 @@ def format_note(actor, note, type="Create"): retooted_user = "@%s@%s" % (original_tooter.username, retoot_instance) retoot_content = _normalise_note(retoot.data["content"]) - return (retoot.data.get("summary", None), "%s (boost %s): %s - %s" % ( + return (retoot.data.get("summary", None), "%s (boost %s): %s" % ( actor.username, retooted_user, retoot_content), retoot_url) elif type == "Create":