Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ui: fixed tombstone dumping. #1135

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions invenio_communities/communities/resources/ui_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,11 @@ def get_permissions(self, obj):
)
return {"can_include_directly": can_include_directly, "can_update": can_update}

@post_dump
def post_dump(self, data, many, **kwargs):
@post_dump(pass_original=True)
def post_dump(self, data, original, many, **kwargs):
"""Pop tombstone field if not deleted/visible."""
is_deleted = (data.get("deletion_status") or {}).get("is_deleted", False)
tombstone_visible = (data.get("tombstone") or {}).get("is_visible", True)
is_deleted = (original.get("deletion_status") or {}).get("is_deleted", False)
tombstone_visible = (original.get("tombstone") or {}).get("is_visible", True)

if not is_deleted or not tombstone_visible:
data.pop("tombstone", None)
Expand Down
Loading