Replies: 1 comment
-
|
Hi @jonodrew thanks for opening the discussion up. I'm interested in contributing. My team have implemented similar capability elsewhere. Maybe there's many ways to achieve it and curious to find out other people's ideas or experience in this area. I'm only 2.5 years into full time Rails development and this is my first delve into the codebar codebase so forgive me if I'm missing some context of the current planner app. The ideas below come from a mixture of working on my current codebase at work, and some help from Codex AI helping guide me on the parts of the code that are already implemented ActionMailer implementationWe already have mailers for various events The approach for automated emailing might be to reuse the existing MemberMailer by adding new reminder actions such as We'd also need to schedule the notifier. This is done in lib/tasks/reminders.rake, but we could add a members.rake perhaps? Then we need some query to detect students to notify. We already have a class to extend here with the logic on who to send to app/models/invitation_manager.rb Saved state ideas:Simplest solution: Add a timestamp columnMy first thought was to add a nullable timestamp on the members table for last sent e.g. More flexible: Introduce a logger tableThe implementation we have in use at my work makes use of an EmailLogger table which persists each email being sent, keyed by user and template. The mailer itself mixes in the EmailLogger concern, which runs an after_action once the email has been built. It records the rendered subject, body, and recipient lists in MemberEmailLogger, keyed to the resource that triggered the notification This can then be queried to discover last sent at by user, or in our case user_email_logger.rb schema.rb email_logger |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
@KimberleyCook has added a set of issues (#2386 , #2385 , #2384 , #2383 ) that all require some kind of automated emailing. They'll also require some kind of saved state - they can't all be triggered by an event.
I'm going to use this discussion thread to discuss how we might do this, and open it up to ideas from colleagues
Beta Was this translation helpful? Give feedback.
All reactions