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

HYC-1994 - Viewer Notification Workflow #1143

Open
wants to merge 70 commits into
base: main
Choose a base branch
from
Open

HYC-1994 - Viewer Notification Workflow #1143

wants to merge 70 commits into from

Conversation

davidcam-src
Copy link
Contributor

https://unclibrary.atlassian.net/browse/HYC-1994

  • Send emails to admin set viewers using DepositedManagerNotification within a new workflow

MANAGING = 'managing'
APPROVING = 'approving'
DEPOSITING = 'depositing'
# [hyc-override] Added Viewing role
Copy link
Member

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?

Copy link
Contributor Author

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'] }
Copy link
Member

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.

Copy link
Contributor Author

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.

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.

2 participants