From f4ada3807caac41276da7ea5ef5f532bf78fa0d3 Mon Sep 17 00:00:00 2001 From: Anika Churilova Date: Mon, 27 May 2024 13:16:05 +0200 Subject: [PATCH] fix tombstone page --- ...tml => restricted_with_doi_tombstone.html} | 0 invenio_app_rdm/records_ui/views/records.py | 21 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) rename invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/{restricted_tombstone.html => restricted_with_doi_tombstone.html} (100%) diff --git a/invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/restricted_tombstone.html b/invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/restricted_with_doi_tombstone.html similarity index 100% rename from invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/restricted_tombstone.html rename to invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/restricted_with_doi_tombstone.html diff --git a/invenio_app_rdm/records_ui/views/records.py b/invenio_app_rdm/records_ui/views/records.py index 7b573b970..30f8e3853 100644 --- a/invenio_app_rdm/records_ui/views/records.py +++ b/invenio_app_rdm/records_ui/views/records.py @@ -419,15 +419,16 @@ def record_permission_denied_error(error): record = getattr(error, "record", None) - is_restricted = record.get("access", {}).get("record", None) == "restricted" - has_doi = "doi" in record.get("pids", {}) - if record and is_restricted and has_doi: - return ( - render_template( - "invenio_app_rdm/records/restricted_tombstone.html", - record=record, - ), - 403, - ) + if record: + is_restricted = record.get("access", {}).get("record", None) == "restricted" + has_doi = "doi" in record.get("pids", {}) + if is_restricted and has_doi: + return ( + render_template( + "invenio_app_rdm/records/restricted_with_doi_tombstone.html", + record=record, + ), + 403, + ) return render_template(current_app.config["THEME_403_TEMPLATE"]), 403