From 801c29380827135595605d44f0ad5d8e7c06c415 Mon Sep 17 00:00:00 2001 From: Javier Romero Castro Date: Fri, 8 Sep 2023 10:18:32 +0200 Subject: [PATCH] service: prevent creating a request if invalid restrictions * Community selection modal checks if the community is restricted and disables it if the record is public * closes https://github.com/inveniosoftware/invenio-app-rdm/issues/2384 --- .../CommunityHeader/CommunityHeader.js | 3 ++ .../CommunityListItem.js | 40 ++++++++++++++----- .../CommunitySelectionModal.js | 4 +- .../CommunitySelectionSearch.js | 8 +++- .../SubmitReviewOrPublishButton.js | 3 ++ .../requests/community_inclusion.py | 4 +- .../requests/community_submission.py | 6 +++ .../services/community_inclusion/service.py | 4 -- tests/resources/test_resources_communities.py | 39 +++++++++++------- tests/services/test_service_review.py | 14 ++++--- 10 files changed, 85 insertions(+), 40 deletions(-) diff --git a/invenio_rdm_records/assets/semantic-ui/js/invenio_rdm_records/src/deposit/components/CommunityHeader/CommunityHeader.js b/invenio_rdm_records/assets/semantic-ui/js/invenio_rdm_records/src/deposit/components/CommunityHeader/CommunityHeader.js index 6dc9f0a0c..7b863e294 100644 --- a/invenio_rdm_records/assets/semantic-ui/js/invenio_rdm_records/src/deposit/components/CommunityHeader/CommunityHeader.js +++ b/invenio_rdm_records/assets/semantic-ui/js/invenio_rdm_records/src/deposit/components/CommunityHeader/CommunityHeader.js @@ -30,6 +30,7 @@ class CommunityHeaderComponent extends Component { showCommunitySelectionButton, disableCommunitySelectionButton, showCommunityHeader, + record, } = this.props; const { modalOpen } = this.state; @@ -73,6 +74,7 @@ class CommunityHeaderComponent extends Component { modalOpen={modalOpen} chosenCommunity={community} displaySelected + record={record} trigger={