diff --git a/mastodon/input.py b/mastodon/input.py index 3c2502e..c607287 100644 --- a/mastodon/input.py +++ b/mastodon/input.py @@ -183,7 +183,7 @@ class MastodonInputService(MastodonService, InputService): "service": self.url, "identifier": status["id"], "parent": parent["id"], - "root": parent["id"] if not parent["root"] else parent["root"], + "root": parent["root"] or parent["id"], } ) else: diff --git a/mastodon/output.py b/mastodon/output.py index c08c232..2e95363 100644 --- a/mastodon/output.py +++ b/mastodon/output.py @@ -295,7 +295,7 @@ class MastodonOutputService(MastodonService, OutputService): ) return - quoted_status_id = quoted_mappings[-1]["identifier"] + quoted_status_id = quoted_mappings[0]["identifier"] post_tokens = post.tokens if ( @@ -356,7 +356,8 @@ class MastodonOutputService(MastodonService, OutputService): if sensitive and sensitive.sensitive: payload["sensitive"] = True - if reply_ref and i == 0: + if reply_ref: + payload["in_reply_to_account_id"] = self.user_id payload["in_reply_to_id"] = reply_ref if quoted_status_id and i == 0: @@ -375,8 +376,7 @@ class MastodonOutputService(MastodonService, OutputService): status_id = response.json()["id"] created_statuses.append(status_id) - if i == 0: - reply_ref = status_id + reply_ref = status_id all_statuses = created_statuses if new_root_id is None or new_parent_id is None: diff --git a/misskey/input.py b/misskey/input.py index 7daeed1..8651f3c 100644 --- a/misskey/input.py +++ b/misskey/input.py @@ -175,7 +175,7 @@ class MisskeyInputService(MisskeyService, InputService): "service": self.url, "identifier": note["id"], "parent": parent["id"], - "root": parent["id"] if not parent["root"] else parent["root"], + "root": parent["root"] or parent["id"], } ) else: