-
Notifications
You must be signed in to change notification settings - Fork 0
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
HYC-1994 - Viewer Notification Workflow #1143
base: main
Are you sure you want to change the base?
Conversation
MANAGING = 'managing' | ||
APPROVING = 'approving' | ||
DEPOSITING = 'depositing' | ||
# [hyc-override] Added Viewing role |
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.
Did this change end up being necessary?
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.
Technically we could avoid adding the viewer role but I think this change results in our update to roles_for_agent being more consistent.
end | ||
|
||
# Select users that have the viewing role applied to them more times than the managing role | ||
only_viewers = user_role_map.select { |user_id, role_counts| role_counts['view'] > role_counts['manage'] } |
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.
If I'm understanding correctly, if a user is associated with an admin set via multiple assignments (potentially a mix of groups and user roles), this would return true only if the user ends up with more viewer roles than manager? I checked with rebekah, and it sounds like we could actually skip sending viewer notifications if the user has any manager role instead.
Since that's the case, you could potentially have the method return as soon as any manager role is encountered rather than proceeding with both queries, but unless these are slow queries it probably won't have too much of a performance impact.
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.
Yeah that's correct. Got it, I might have been overthinking a bit — made some changes.
https://unclibrary.atlassian.net/browse/HYC-1994