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

[DUOS-1967][risk=no] Only show registered users in Add New Researcher modal #1737

Merged
merged 8 commits into from
Aug 31, 2022

Conversation

connorlbark
Copy link
Contributor

@connorlbark connorlbark commented Aug 5, 2022

Addresses

https://broadworkbench.atlassian.net/browse/DUOS-1967


Have you read Terra's Contributing Guide lately? If not, do that first.

  • Label PR with a Jira ticket number and include a link to the ticket
  • Label PR with a security risk modifier [no, low, medium, high]
  • PR describes scope of changes
  • Get a minimum of one thumbs worth of review, preferably two if enough team members are available
  • Get PO sign-off for all non-trivial UI or workflow changes
  • Verify all tests go green
  • Test this change deployed correctly and works on dev environment after deployment

@connorlbark connorlbark changed the title [DUOS-1967][risk=no] WIP Remove add new researcher from SO console [DUOS-1967][risk=no] Remove add new researcher from SO console Aug 5, 2022
@connorlbark connorlbark marked this pull request as ready for review August 5, 2022 17:39
@connorlbark connorlbark requested a review from a team as a code owner August 5, 2022 17:39
Copy link
Contributor

@shaemarks shaemarks left a comment

Choose a reason for hiding this comment

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

Approach makes sense to me. The only thing I'm wondering is if there are liability reasons for needing the lca text available on the page

@rushtong
Copy link
Contributor

rushtong commented Aug 5, 2022

@connorlbark - let's bring this up with Jonathan/Pamela. From my poor memory, we do want to be able to add a library card for an unregistered user - that was an original design goal. There was some logic somewhere that would look for unregistered user LCs and link them up if a new user signed in with the email associated to the LC.

@connorlbark
Copy link
Contributor Author

@connorlbark - let's bring this up with Jonathan/Pamela. From my poor memory, we do want to be able to add a library card for an unregistered user - that was an original design goal. There was some logic somewhere that would look for unregistered user LCs and link them up if a new user signed in with the email associated to the LC.

Talked to Pamela - so you're right that the ability to type in a freetext email is desirable, but the ability to see users without insitutions is not. I will add back the Add New Researcher popup to this PR but remove the users without institutions.

@connorlbark connorlbark changed the title [DUOS-1967][risk=no] Remove add new researcher from SO console [DUOS-1967][risk=no] Only show registered users in Add New Researcher modal Aug 8, 2022
@connorlbark connorlbark marked this pull request as ready for review August 8, 2022 18:07
@@ -198,6 +198,10 @@ const generateLcaText = (text) => {
</ReactMarkdown>;
};

const onlyResearchersWithoutCardFilter = (researcher) => {
return isNil(researcher.libraryCards);
Copy link
Contributor

Choose a reason for hiding this comment

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

I can imagine an edge case where a researcher belongs to this institution, doesn't have a library card from this institution, but does have another library card (since admins can technically give researchers library cards from any institution). In that case, they'll appear in the table but not the dropdown in the modal. Not sure how big of an issue this is though

Copy link
Contributor

Choose a reason for hiding this comment

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

Great catch @shaemarks ... and you're right. There will be cases where a user will have library cards from other institutions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed the filter here and also the filter in the table itself to check that the SO's institution id the same as the card's institution id

@rushtong
Copy link
Contributor

FYI, the modal has a couple of issues. The prompt text and selection lets me add new users via email. It would be nice to clean up the button alignment as well if possible.

Screen Shot 2022-08-10 at 7 47 59 AM

Screen Shot 2022-08-10 at 7 48 52 AM

Copy link
Contributor

@rushtong rushtong left a comment

Choose a reason for hiding this comment

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

Looking good, see comments inline.

@@ -20,13 +19,7 @@ export default function SigningOfficialResearchers() {
try {
setIsLoading(true);
const soUser = await User.getMe();
const soPromises = await Promise.all([
User.list(USER_ROLES.signingOfficial),
User.getUnassignedUsers()
Copy link
Contributor

Choose a reason for hiding this comment

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

This was the only usage of User.getUnassignedUsers() so we can remove it, along with deprecating the API method in consent: GET /api/user/institution/unassigned

Copy link
Contributor Author

@connorlbark connorlbark Aug 12, 2022

Choose a reason for hiding this comment

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

it's also used in SigningOfficialDataSubmitters.js; is that deprecated code? (also signing official console, but that is being deprecated)

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like I was incorrect ... it is used in three places in develop right now, not sure how I missed them.

  • SigningOfficialConsole
  • SigningOfficialDataSubmitters
  • SigningOfficialResearchers

User.getUnassignedUsers()
]);
const researcherList = soPromises[0];
const unregisteredResearchers = soPromises[1];
Copy link
Contributor

@rushtong rushtong Aug 10, 2022

Choose a reason for hiding this comment

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

Just a note that the naming here was incorrect, these were not unregistered users, they were registered users with no institution selection.

Naming is hard. The API call was actually returning unregistered users with a LC for the calling user's institution, so User.getUnassignedUsers() is what is mis-named here.

@connorlbark
Copy link
Contributor Author

FYI, the modal has a couple of issues. The prompt text and selection lets me add new users via email. It would be nice to clean up the button alignment as well if possible.

@rushtong I messaged Pamela about this. Here is what she said about the popup: I think the popup is still helpful because I believe SOs can type in the email of an unregistered user and issue them a Library Card. I think that is still a good feature. I believe the ability to enter freetext emails is good, however the users which displayed when searching were the issue.

I am confused though on the getUnassignedUsers call; we don't need this call, right? In other words, the current behavior of the modal is right, but the feedback/changers here are to update the styling?

@rushtong
Copy link
Contributor

@rushtong I messaged Pamela about this. Here is what she said about the popup: I think the popup is still helpful because I believe SOs can type in the email of an unregistered user and issue them a Library Card. I think that is still a good feature. I believe the ability to enter freetext emails is good, however the users which displayed when searching were the issue.

I may have been confused about the goal of the ticket/PR - I was under the impression that the intention was to STOP creating Library Cards for users who are not already registered with the signing official's institution. I would be happy to be wrong here, but it does add some complications to the new designs of Signing Official pages. If so, ignore my feedback about the modal and free text usage.

I am confused though on the getUnassignedUsers call; we don't need this call, right? In other words, the current behavior of the modal is right, but the feedback/changers here are to update the styling?

User.getUnassignedUsers() calls GET /api/user/institution/unassigned which returns a list of users who do not have an institution. If we're not querying for those users, we don't need to make that call here.

@connorlbark
Copy link
Contributor Author

I may have been confused about the goal of the ticket/PR - I was under the impression that the intention was to STOP creating Library Cards for users who are not already registered with the signing official's institution. I would be happy to be wrong here, but it does add some complications to the new designs of Signing Official pages. If so, ignore my feedback about the modal and free text usage.

Sounds good to me! We can also open a dialogue with Pamela/Jonathan if you think the behavior should be different.

Copy link
Contributor

@shaemarks shaemarks left a comment

Choose a reason for hiding this comment

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

Looks good to me! Styling on modal looks much better!

Co-authored-by: shaemarks <81024249+shaemarks@users.noreply.github.com>
@connorlbark connorlbark merged commit 363e197 into develop Aug 31, 2022
@connorlbark connorlbark deleted the DUOS-1967 branch August 31, 2022 17:31
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.

3 participants