Skip to content

Commit 253c4a6

Browse files
committed
record: fix display of deleted record community
1 parent 18b74a8 commit 253c4a6

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

invenio_app_rdm/records_ui/views/records.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
from flask import abort, current_app, g, redirect, render_template, request, url_for
1717
from flask_login import current_user
1818
from invenio_base.utils import obj_or_import_string
19+
from invenio_communities.errors import CommunityDeletedError
20+
from invenio_communities.proxies import current_communities
1921
from invenio_previewer.extensions import default as default_previewer
2022
from invenio_previewer.proxies import current_previewer
2123
from invenio_rdm_records.proxies import current_rdm_records
@@ -67,11 +69,20 @@ def get_record_community(record):
6769
) or expanded_parent.get("communities", {}).get("default")
6870

6971
if community_review or community_default:
70-
is_community_deleted = expanded_community.get("is_ghost", False)
71-
if is_community_deleted:
72+
is_community_pid_deleted = expanded_community.get("is_ghost", False)
73+
if is_community_pid_deleted:
74+
# community pid is not found in search i.e its pid is deleted
7275
return None, community_id
73-
else:
76+
77+
# resolve the community again to check the deletion status
78+
# deleted communities with tombstones are not idenitfied as ghost records
79+
# at the moment because `read_many()` function is not filtering them out
80+
try:
81+
current_communities.service.read(id_=community_id, identity=g.identity)
82+
# community has not tombstone
7483
return expanded_community, community_id
84+
except CommunityDeletedError:
85+
return None, community_id
7586
else:
7687
return None, None
7788

0 commit comments

Comments
 (0)