diff --git a/CHANGELOG.md b/CHANGELOG.md index 5773c5a..681b259 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,9 @@ * New style Diaspora public payloads are now supported (see [here](https://github.com/diaspora/diaspora_federation/issues/30)). Old style payloads are still supported. Payloads are also still sent out old style. * Add new `Follow` base entity and support for the new Diaspora "contact" payload. The simple `Follow` maps to Diaspora contact entity with following/sharing both true or false. Sharing as a separate concept is not currently supported. +### Fixed +* Legacy Diaspora retraction of sharing/following is now supported correctly. The end result is a `DiasporaRetraction` for entity type `Profile`. + ## [0.11.0] - 2017-05-08 diff --git a/federation/entities/diaspora/entities.py b/federation/entities/diaspora/entities.py index 39d00ca..9ad9889 100644 --- a/federation/entities/diaspora/entities.py +++ b/federation/entities/diaspora/entities.py @@ -172,6 +172,7 @@ class DiasporaRetraction(DiasporaEntityMixin, Retraction): mapped = { "Like": "Reaction", "Photo": "Image", + "Person": "Profile", } def to_xml(self): diff --git a/federation/tests/entities/diaspora/test_mappers.py b/federation/tests/entities/diaspora/test_mappers.py index bd2b96b..9f623dc 100644 --- a/federation/tests/entities/diaspora/test_mappers.py +++ b/federation/tests/entities/diaspora/test_mappers.py @@ -14,7 +14,8 @@ from federation.tests.fixtures.keys import get_dummy_private_key from federation.tests.fixtures.payloads import ( DIASPORA_POST_SIMPLE, DIASPORA_POST_COMMENT, DIASPORA_POST_LIKE, DIASPORA_REQUEST, DIASPORA_PROFILE, DIASPORA_POST_INVALID, DIASPORA_RETRACTION, - DIASPORA_POST_WITH_PHOTOS, DIASPORA_POST_LEGACY_TIMESTAMP, DIASPORA_POST_LEGACY, DIASPORA_CONTACT) + DIASPORA_POST_WITH_PHOTOS, DIASPORA_POST_LEGACY_TIMESTAMP, DIASPORA_POST_LEGACY, DIASPORA_CONTACT, + DIASPORA_LEGACY_REQUEST_RETRACTION) def mock_fill(attributes): @@ -154,6 +155,15 @@ class TestDiasporaEntityMappersReceive(): assert entity.target_guid == "x" * 16 assert entity.entity_type == "Post" + def test_message_to_objects_retraction_legacy_request(self): + entities = message_to_objects(DIASPORA_LEGACY_REQUEST_RETRACTION) + assert len(entities) == 1 + entity = entities[0] + assert isinstance(entity, Retraction) + assert entity.handle == "jaywink@iliketoast.net" + assert entity.target_guid == "7ed1555bc6ae03db" + assert entity.entity_type == "Profile" + def test_message_to_objects_contact(self): entities = message_to_objects(DIASPORA_CONTACT) assert len(entities) == 1 diff --git a/federation/tests/fixtures/payloads.py b/federation/tests/fixtures/payloads.py index ead44d5..5d3c141 100644 --- a/federation/tests/fixtures/payloads.py +++ b/federation/tests/fixtures/payloads.py @@ -174,6 +174,14 @@ DIASPORA_RETRACTION = """ """ +DIASPORA_LEGACY_REQUEST_RETRACTION = """ + + jaywink@iliketoast.net + 7ed1555bc6ae03db + Person + +""" + DIASPORA_CONTACT = """ alice@example.com