Skip to content

API: Fix notify by email endpoint names and params#4617

Merged
pglombardo merged 8 commits into
masterfrom
simplify-notify-by-email
Jul 6, 2026
Merged

API: Fix notify by email endpoint names and params#4617
pglombardo merged 8 commits into
masterfrom
simplify-notify-by-email

Conversation

@ozovalihasan

@ozovalihasan ozovalihasan commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Description

Current endpoint fields used to create notify_by_email records made same implementation on SaaS one harder. So, fields already defined by SaaS, notify_emails_to and notify_emails_to_locale, are defined to be used.

Related Issue

#4167

Type of Change

  • 📦 Dependency & security updates
  • 🔧 Bug fix (non-breaking change which fixes an issue)
  • 🥂 Improvement (non-breaking change which improves an existing feature)
  • 🚀 New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to change)
    Note: Technically these changes may brake some API requests. But, this feature is introduced a few days ago, so any requests sent to create notify_by_email shouldn't be broken.
  • 🔐 Security fix
  • 📚 Examples / documentation / tutorials

Checklist

  • I've written tests (if applicable) for all new methods and classes that I created. (rake test)
  • I've added documentation as necessary so users can easily use and understand this feature/fix.

Note

Medium Risk
Breaking v2 API and route names for a new feature; behavior depends on after_validation mapping to legacy internal fields—regression risk if mapping or required-flag handling is wrong on create vs post-create notify.

Overview
Breaking API and form rename for email notifications: clients and UI now use flat notify_emails_to and notify_emails_to_locale instead of nested notify_by_email / notify_by_email_recipients fields. The member action and route notify_by_email become notify_emails (web and POST /api/v2/pushes/:token/notify_emails).

Controllers stop manually copying recipient params; they permit the new attributes on create and call shared Pwpush::AssignNotifiableByEmailFields to set notify_by_email_creator and notify_emails_to_required. Pwpush::NotifiableByEmail validates the public fields, maps them to internal notify_by_email_recipients / notify_by_email_locale after validation (so AuditLog / NotifyByEmail / SendNotifyByEmailJob stay the same), and returns field-level errors instead of mostly :base messages.

Create responses expose notify_emails_to at the top level in JSON (no nested notify_by_email object). Docs, partials, and tests are updated throughout; push update no longer accepts notify fields via update_params (unchanged behavior, explicit test removed).

Reviewed by Cursor Bugbot for commit 7a4c6d0. Bugbot is set up for automated code reviews on this repo. Configure here.

@ozovalihasan ozovalihasan marked this pull request as draft July 6, 2026 13:25
@ozovalihasan

Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread app/models/concerns/pwpush/notifiable_by_email.rb
@ozovalihasan

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit b07d403. Configure here.

@ozovalihasan ozovalihasan marked this pull request as ready for review July 6, 2026 16:01
@ozovalihasan ozovalihasan requested a review from pglombardo July 6, 2026 16:01
@pglombardo pglombardo changed the title Update endpoints used to create notify_by_email API: Fix notify by email endpoint names and params Jul 6, 2026
@pglombardo pglombardo merged commit 626020f into master Jul 6, 2026
3 checks passed
@pglombardo pglombardo deleted the simplify-notify-by-email branch July 6, 2026 16:38
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