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

requests: split mine and shared with me #426

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

zzacharo
Copy link
Member

@zzacharo zzacharo commented Feb 15, 2025

@zzacharo zzacharo force-pushed the requests-shared-mine branch from 4a7878a to 6c66e47 Compare February 15, 2025 20:00
* adds `shared_with_me` param to filter requests
* adds dashboard dropdown to filter requests
* adds topic generator on `can_read` request permission
* relies on `can_read` request permission to search user requests
@zzacharo zzacharo force-pushed the requests-shared-mine branch from 6c66e47 to 63d4963 Compare February 15, 2025 20:17
@zzacharo zzacharo changed the title requests: split mine and shared with me entries requests: split mine and shared with me Feb 15, 2025
@zzacharo zzacharo marked this pull request as draft February 17, 2025 10:44
@zzacharo zzacharo force-pushed the requests-shared-mine branch from 9f5c1cd to 503d554 Compare February 20, 2025 15:37
@@ -90,7 +90,7 @@ RequestStatusFilterComponent.propTypes = {
};

RequestStatusFilterComponent.defaultProps = {
keepFiltersOnUpdate: false,
keepFiltersOnUpdate: true,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to keep the filters so that they can be combined with the new shared_with_me one

@zzacharo zzacharo marked this pull request as ready for review February 20, 2025 15:38
# My requests
search = search.filter(my_requests_q)

return search
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are ParamInterpreters easily unit testable?
The my_requests_q seems counter-intuitive to me, it reads like "the request is created by me and I'm also the receiver", is it correct?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes my_requests reflects all requests a user created or receives. I will check if there is any test for that but still I am missing some tests, which most probably will go to rdm-records where the record as a topic concept is defined :)

Copy link
Contributor

@jrcastro2 jrcastro2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTU! Peer reviewed with @sakshamarora1

Maybe some tests would be nice as Pablo suggested.

Seems that tests are failing due to isort and permission denied error.

@@ -288,16 +288,13 @@ def search_user_requests(
identity,
params,
search_preference,
permission_action=None,
permission_action="read",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this change needed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be able to apply search filtering based on user's permissions.

@@ -16,13 +16,16 @@ import { GridResponsiveSidebarColumn } from "react-invenio-forms";
import { SearchBar } from "react-searchkit";
import { Button, Container, Grid } from "semantic-ui-react";

import { SharedOrMineFilter } from "@js/invenio_app_rdm/components/SharedOrMineFilter";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong import, you shouldn't import from app_rdm since app_rdm depends on requests not the other way around

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still wip this version :) Sorry I will move the PRs back in progress until I cleanup the new code added

@zzacharo zzacharo force-pushed the requests-shared-mine branch from fa49350 to c89349d Compare March 3, 2025 17:26
@zzacharo zzacharo force-pushed the requests-shared-mine branch from c89349d to 56cc28c Compare March 4, 2025 13:32
obj.includes("shared_with_me")
);
if (sharedWithMe) {
// eslint-disable-next-line react/no-did-mount-set-state
Copy link
Contributor

@kpsherva kpsherva Mar 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry for duplication, the same comment applies now here
inveniosoftware/invenio-app-rdm#2982 (comment)
can we avoid setting state in the mount? It would be better to move to the constructor, no?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed it! It was copied from another place and I fixed both of them

@zzacharo zzacharo force-pushed the requests-shared-mine branch from 6093bf8 to 371bd96 Compare March 7, 2025 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sharing a draft/record doesn't give access to corresponding record requests
5 participants