Fix sharedInbox from remote ActivityPub profiles

Fix reading `sharedInbox` from remote ActivityPub profiles. This caused public payloads not
to be deduplicated when sending public payloads to remote ActivityPub servers. Refetching
profiles should now fix this.

Closes #124
merge-requests/160/merge
Jason Robinson 2020-02-22 01:31:46 +02:00
rodzic 58d092d5f3
commit fd63767263
3 zmienionych plików z 11 dodań i 3 usunięć

Wyświetl plik

@ -49,7 +49,11 @@
to be set, not just `target_id`. This fixes follows over the Diaspora protocol which
broke with stricter send validation added in 0.19.0.
* Fix some edge case crashes of `handle_send` when there are Diaspora protocol receivers.
* Fix some edge case crashes of `handle_send` when there are Diaspora protocol receivers.
* Fix reading `sharedInbox` from remote ActivityPub profiles. This caused public payloads not
to be deduplicated when sending public payloads to remote ActivityPub servers. Refetching
profiles should now fix this. ([related issue](https://git.feneas.org/jaywink/federation/issues/124))
## [0.19.0] - 2019-12-15

Wyświetl plik

@ -272,11 +272,11 @@ def transform_attribute(
# Assume HTML by convention
transformed["_rendered_content"] = payload.get('content').strip()
transformed["_media_type"] = "text/html"
elif key == "inboxes" and isinstance(value, dict):
elif key == "endpoints" and isinstance(value, dict):
if "inboxes" not in transformed:
transformed["inboxes"] = {"private": None, "public": None}
if value.get('sharedInbox'):
transformed["endpoints"]["public"] = value.get("sharedInbox")
transformed["inboxes"]["public"] = value.get("sharedInbox")
elif key == "icon":
# TODO maybe we should ditch these size constants and instead have a more flexible dict for images
# so based on protocol there would either be one url or many by size name

Wyświetl plik

@ -171,6 +171,10 @@ class TestActivitypubEntityMappersReceive:
assert len(entities) == 1
profile = entities[0]
assert profile.id == "https://diaspodon.fr/users/jaywink"
assert profile.inboxes == {
"private": "https://diaspodon.fr/users/jaywink/inbox",
"public": "https://diaspodon.fr/inbox",
}
assert profile.handle == ""
assert profile.name == "Jason Robinson"
assert profile.image_urls == {