Skip to content

Initial email over free user event driven email

Doug Stull requested to merge 415487-initial-over-limit-email into master

What does this MR do and why?

Initial email over free user event driven email

  • MVC to alert owners of free user cap eligible namespaces that they are over the limit.
  • Minimal vertical change, so for now we'll leave out the logic to figure out if the member adds caused the overage. That logic will be added in !134410 (merged).
  • The feature flag will remain disabled until needed logic is added in subsequent MRs.
  • Place many guards in the code to help reduce possible performance impacts.
  • puts this after action in the batch operational area of adding members in order to:
    • stay away from adding more callbacks on member model(after_create)
    • more targeted approach
    • reduces the number of times this worker will be called since our placement for 10 invited users will mean it only gets called 1 time instead of 10. Thus reducing the case of background workers getting out of order and possibly sending duplicate emails.
    • we do this calculation/determination after members have been added in foreground since doing this also in the foreground would add delays to the UI/API layer.

Screenshots or screen recordings

html text
Screenshot_2023-10-26_at_6.57.47_PM Screenshot_2023-10-27_at_9.14.34_AM

How to set up and validate locally

  1. Setup initial application settings in bundle exec rails c
    ApplicationSetting.first.update(dashboard_limit_enabled: true, dashboard_limit: 5)
    Feature.enable(:free_user_cap_over_limit_email)
  2. Simulate Saas and restart GDK
  3. Create a new top-level private group(A).
  4. Create a public(for ease of example so limit isn't applied) new top-level group(B).
  5. Go to the first top-level private group's member page and invite group B.
  6. Confirm on page reload no free user cap alerts exist(yet) and members are under 5.
  7. Go to the members page of group B and invite 6 users by username.
  8. Go to the members page of group A and confirm over limit alert message appears(not added by this MR).
  9. Go to http://gdk.test:3000/rails/letter_opener/ and verify email is seen.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #415487

Edited by Doug Stull

Merge request reports