-
Notifications
You must be signed in to change notification settings - Fork 37
feat: reviewers: add users/groups as reviewers to requests #431
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
feat: reviewers: add users/groups as reviewers to requests #431
Conversation
63a31fc
to
1fd7188
Compare
19c3e15
to
c2b6788
Compare
invenio_requests/assets/semantic-ui/js/invenio_requests/api/InvenioRequestApi.js
Outdated
Show resolved
Hide resolved
db708dd
to
c462b76
Compare
invenio_requests/assets/semantic-ui/js/invenio_requests/api/InvenioRequestApi.js
Outdated
Show resolved
Hide resolved
invenio_requests/assets/semantic-ui/js/invenio_requests/InvenioRequestsApp.js
Outdated
Show resolved
Hide resolved
invenio_requests/assets/semantic-ui/js/invenio_requests/request/RequestReviewers.js
Outdated
Show resolved
Hide resolved
invenio_requests/assets/semantic-ui/js/invenio_requests/request/RequestReviewers.js
Outdated
Show resolved
Hide resolved
invenio_requests/assets/semantic-ui/js/invenio_requests/request/RequestReviewers.js
Outdated
Show resolved
Hide resolved
my_requests_query = self._generate_my_requests_query(identity) | ||
# Topic grants include requests created by the user or the user is the receiver, | ||
# so we need to exclude them | ||
return dsl.Q("terms", **{"grants": grants}) & ~my_requests_query | ||
return ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: we should add this use case on the documentation regarding "what you can see on the Shared with me requests under my dashboard"
@@ -73,6 +73,14 @@ export class InvenioRequestsAPI { | |||
}); | |||
}; | |||
|
|||
addReviewer = async (reviewers) => { | |||
return await http.put(this.#urls.self, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add the cancellable wrapper to avoid memory leaks if component is unmounted
invenio_requests/assets/semantic-ui/js/invenio_requests/request/RequestReviewers.js
Outdated
Show resolved
Hide resolved
invenio_requests/assets/semantic-ui/js/invenio_requests/requestsAppInit.js
Outdated
Show resolved
Hide resolved
6c94bc6
to
1f43b0f
Compare
"accepted", | ||
"declined", | ||
], | ||
[Creator(), Receiver(), Reviewers(), Topic()], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yashlamba we need to add here an IFConfig()
to add reviewers to the permission only if the feature is enabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if the IfConfig
pattern is a good fit here. If you have the feature disabled, it means you can't add reviewers via the service component, which already takes the feature flag into account.
In general, we should be using the config so that:
- the service component ignores or takes into account the passed
reviewers
value in create/update - the UI shows/hides the "Reviewers" box entirely in the request item page
- if the feature is enabled though, the box is shown and if the user has permissions to update reviewers they should also see the searchbox so they can manage them
Permissions-based enabling/disabling of the feature leads to confusing DX and expectations, see e.g. the community membership request feature, which displays the "Request membership" button to admins, but clicking it leads to a 500 page.
635a289
to
7df1a4a
Compare
This commit introduces a complete reviewers system for Invenio Requests, enabling assignment and management of reviewers throughout the request lifecycle. **Frontend Changes:** - Add RequestReviewers React component with search and selection functionality - Implement CollapsedHeader, ReviewerSearch, and SelectedReviewersList components - Add reviewer management UI to request details page - Integrate reviewers timeline events and API endpoints **Backend Changes:** - Add RequestReviewersComponent for service layer reviewer management - Implement ReviewersUpdatedType custom event for timeline tracking - Add reviewer-specific permissions and access control generators - Update request schema and mappings to support reviewers field - Add multi-entity reference support for reviewer entities **Database & Schema:** - Update OpenSearch mappings (v1, v2, v7) with dynamic reviewer templates - Extend request JSON schema with reviewers definitions - Add reviewer entity reference system fields **Configuration & Permissions:** - Make reviewers configurable through request types - Add reviewer-specific permission checks and generators - Update service configurations to handle reviewer operations **API & Services:** - Extend request service with reviewer update capabilities - Add reviewer-specific API endpoints and parameters - Implement proper validation and error handling for reviewer operations **Testing & Quality:** - Update test configurations and fixtures - Fix linting issues and code style violations - Add comprehensive test coverage for reviewer functionality This implementation provides a complete reviewers workflow including assignment, removal, permission management, and timeline tracking while maintaining backward compatibility with existing request functionality. Co-authored-by: Yash Lamba <[email protected]>
7df1a4a
to
0f1ff6e
Compare
* partial backport of inveniosoftware#431 * previously, `has_permissions_to()` was reused from the parent class, which passed the request object as `record` only * some permission generators expect the request to be available under the name `request` however
* partial backport of #431 * previously, `has_permissions_to()` was reused from the parent class, which passed the request object as `record` only * some permission generators expect the request to be available under the name `request` however
closes #428
Requires: inveniosoftware/invenio-records-resources#615