-
Notifications
You must be signed in to change notification settings - Fork 3
Feature: more specific mailing #1231
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
Changes from all commits
0119de7
d86d6ea
e78cc97
c8071ad
23fb8e2
343b936
9dd7310
2f133d2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -7,15 +7,17 @@ def insufficient_credit_mail(user) | |||||
| mail to: user.email, subject: 'Verzoek met betrekking tot uw Zatladder saldo' | ||||||
| end | ||||||
|
|
||||||
| def credit_delivery_report_mail(treasurer, success_count, unnotifyable_users) | ||||||
| @user = treasurer | ||||||
| def credit_delivery_report_mail(success_count, unnotifyable_users) | ||||||
| @user = Struct.new(:name).new( | ||||||
| Rails.application.config.x.treasurer_name | ||||||
| ) | ||||||
| @unnotifyable_users = unnotifyable_users | ||||||
| @success_count = success_count | ||||||
| @title = 'Notificatie over de saldomail' | ||||||
|
|
||||||
| subject = "Er is #{@success_count.positive? ? 'een' : 'geen'} saldomail verstuurd" | ||||||
|
|
||||||
| mail to: treasurer.email, subject: | ||||||
| mail to: Rails.application.config.x.treasurer_email, subject: | ||||||
|
||||||
| mail to: Rails.application.config.x.treasurer_email, subject: | |
| mail to: Rails.application.config.x.treasurer_email, subject: subject |
Copilot
AI
Feb 18, 2026
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.
credit_delivery_report_mail no longer sets @user, but the shared mailer layout renders Beste <%= @user.name %>, (see app/views/layouts/mailer.html.erb:364). This will raise a NoMethodError when generating the report email. Set @user to a suitable object (e.g., a lightweight struct using config.x.treasurer_name/treasurer_title) or update the mailer layout to handle the report mail without requiring @user.
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.
Extract the Struct to a constant and guard against a
niltreasurer name.Two concerns here:
Struct.new(:name)anti-pattern —Struct.new(...)inside an instance method creates an unnecessary new anonymous class on every invocation, which also creates new independent entries in the method cache. Sincetreasurer_nameis a single static field, define the Struct as a class-level constant instead.Silent blank name —
config/application.rbsetstreasurer_nametoENV.fetch('TREASURER_NAME', nil), so@user.namewill benilwhen the env var is absent. If the template uses@user.namein a greeting, it renders blank with no warning.♻️ Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents