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

[#2733/#8331] Prevent request classification notifications #8578

Closed
wants to merge 4 commits into from

Conversation

gbp
Copy link
Member

@gbp gbp commented Feb 11, 2025

Relevant issue(s)

Fixes #2733
Fixes #8331

What does this do?

  1. Prevent request classification notifications for older requests (older than 6 months)
  2. Prevent project classification notifications

Why was this needed?

If a requester hasn't classified their request within 6 months then more than likely they don't care if their request has been classified.

Sometimes this years can go by before classification which can cause in the requester contacting us for support.

For projects classification, many notifications can be sent over a short period of time. These changes prevents them from being sent at all.

Implementation notes

Build upon CanCan abilities so we can, in the future, offer fine grain permissions for users on which emails they'll receive.

gbp added 2 commits February 11, 2025 18:38
Use CanCan abilities to determine if a mailer is allowed to send a user
an email.
Prevent requesters of old requests from being notified when their
request has been classified.

Fixes #2733
@gbp
Copy link
Member Author

gbp commented Feb 11, 2025

@garethrees any thoughts on the implementation approach I've used to isolate the logic using CanCan abilities?

Copy link
Member

@garethrees garethrees left a comment

Choose a reason for hiding this comment

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

any thoughts on the implementation approach I've used to isolate the logic using CanCan abilities?

Interesting! Novel use of abilities and quite nice that we could use them to keep a bunch of "send if/unless" type logic contained so that the code that calls the mailer method doesn't have to keep repeating it all over the shop.

On the other hand I do wonder whether it adds a bit too much indirection. My first thought was that I could imagine extracting the mailer method and all those conditionals to a ClassificationMailer, though I haven't thought much about the specific details here and how we'd pass some of the of the required arguments around.

Looks like old_unclassified_updated is only actually called in one place. This has got me thinking whether we could just drop this entirely.

I wonder how many requests that are old_unclassified are actually less than 6 months old…

alaveteli(prod)> InfoRequest.is_public.where_old_unclassified.count
# => 154420
alaveteli(prod)> InfoRequest.is_public.where_old_unclassified.where(created_at: 6.months.ago..Time.zone.now).count
# => 13452

…less than 10%. Not sure it seems worth it for a small minority of requests that would potentially receive this mail?

We could add a condition to where_old_unclassified / is_old_unclassified to only include requests > 6 months old and just drop the mail entirely. Some requests may get classified a bit slower than before, but we're probably not talking loads.

If there is a good reason for keeping it, then I think tidying up the "should we actually send this" logic into one place would be good (so, the > 6 month check plus all the existing ones).

gbp added 2 commits February 12, 2025 12:56
Stop emailing requesters when project contributors classify requests.

Fixes #8331
@gbp gbp changed the title [#2733] Prevent request classification notifications [#2733/#8331] Prevent request classification notifications Feb 12, 2025
@gbp
Copy link
Member Author

gbp commented Feb 13, 2025

After discussing with @garethrees and @HelenWDTK we've opted to remove this email. See: #8580

@gbp gbp closed this Feb 13, 2025
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.

Projects: Prevent Classification Notifications Old Request Classification: Prevent Notifications & Bumping
2 participants