kopia lustrzana https://gitlab.com/jaywink/federation
rodzic
0363260374
commit
5580b5143f
|
@ -4,7 +4,8 @@
|
|||
|
||||
### Fixed
|
||||
* Fix getting sender from a combination of legacy Diaspora encrypted payload and new entity names (for example `author`). This combination probably only existed in this library.
|
||||
* Correctly extend entity `_children`. Certain Diaspora payloads caused `_children` for an entity to be written over by an empty list, causing for example status message photos to not be saved. Correctly do an extend on it.
|
||||
* Correctly extend entity `_children`. Certain Diaspora payloads caused `_children` for an entity to be written over by an empty list, causing for example status message photos to not be saved. Correctly do an extend on it. ([issue](https://github.com/jaywink/federation/issues/89))
|
||||
* Fix parsing Diaspora profile `tag_string` into `Profile.tag_list` if the `tag_string` is an empty string. This caused the whole `Profile` object creation to fail. ([issue](https://github.com/jaywink/federation/issues/88))
|
||||
|
||||
### Removed
|
||||
* `Post.photos` entity attribute was never used by any code and has been removed. Child entities of type `Image` are stored in the `Post._children` as before.
|
||||
|
|
|
@ -165,7 +165,8 @@ def transform_attributes(attrs, cls):
|
|||
transformed["image_urls"] = {}
|
||||
transformed["image_urls"]["medium"] = value
|
||||
elif key == "tag_string":
|
||||
transformed["tag_list"] = value.replace("#", "").split(" ")
|
||||
if value:
|
||||
transformed["tag_list"] = value.replace("#", "").split(" ")
|
||||
elif key == "bio":
|
||||
transformed["raw_content"] = value
|
||||
elif key == "searchable":
|
||||
|
|
|
@ -15,7 +15,7 @@ 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_LEGACY_REQUEST_RETRACTION, DIASPORA_POST_WITH_PHOTOS_2)
|
||||
DIASPORA_LEGACY_REQUEST_RETRACTION, DIASPORA_POST_WITH_PHOTOS_2, DIASPORA_PROFILE_EMPTY_TAGS)
|
||||
|
||||
|
||||
def mock_fill(attributes):
|
||||
|
@ -153,6 +153,11 @@ class TestDiasporaEntityMappersReceive():
|
|||
assert profile.nsfw == False
|
||||
assert profile.tag_list == ["socialfederation", "federation"]
|
||||
|
||||
@patch("federation.entities.diaspora.entities.DiasporaProfile.fill_extra_attributes", new=mock_fill)
|
||||
def test_message_to_objects_profile_survives_empty_tag_string(self):
|
||||
entities = message_to_objects(DIASPORA_PROFILE_EMPTY_TAGS)
|
||||
assert len(entities) == 1
|
||||
|
||||
def test_message_to_objects_retraction(self):
|
||||
entities = message_to_objects(DIASPORA_RETRACTION)
|
||||
assert len(entities) == 1
|
||||
|
|
|
@ -190,6 +190,23 @@ DIASPORA_PROFILE = """
|
|||
</profile>
|
||||
"""
|
||||
|
||||
DIASPORA_PROFILE_EMPTY_TAGS = """
|
||||
<profile>
|
||||
<author>bob@example.com</author>
|
||||
<first_name>Bob Bobertson</first_name>
|
||||
<last_name></last_name>
|
||||
<image_url>https://example.com/uploads/images/thumb_large_c833747578b5.jpg</image_url>
|
||||
<image_url_small>https://example.com/uploads/images/thumb_small_c8b147578b5.jpg</image_url_small>
|
||||
<image_url_medium>https://example.com/uploads/images/thumb_medium_c8b1aab04f3.jpg</image_url_medium>
|
||||
<gender></gender>
|
||||
<bio>A cool bio</bio>
|
||||
<location>Helsinki</location>
|
||||
<searchable>true</searchable>
|
||||
<nsfw>false</nsfw>
|
||||
<tag_string/>
|
||||
</profile>
|
||||
"""
|
||||
|
||||
DIASPORA_RETRACTION = """
|
||||
<retraction>
|
||||
<author>bob@example.com</author>
|
||||
|
|
Ładowanie…
Reference in New Issue