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

V2 #313

Merged
merged 42 commits into from
Jan 15, 2024
Merged

V2 #313

merged 42 commits into from
Jan 15, 2024

Conversation

excid3
Copy link
Owner

@excid3 excid3 commented Oct 12, 2023

This introduced a new major version of Noticed with some big improvements.

  • Rename Notifications to Notifiers (to prevent confusion with the Notification db model).
  • Remove backports for Rails 5.2 and require 6.1+ (same as what Rails supports).
  • Add record{polymorphic} association to Notification model to improve querying ergonomics.
  • Add NotificationRecipient model to reduce data duplication.
  • Remove http gem dependency and replace with net/http
  • Add config block for organizing delivery method options.
  • Readd if, unless and delay options
  • Drop TextCoder
  • Update documentation

@excid3 excid3 added the enhancement New feature or request label Oct 12, 2023
@excid3 excid3 added this to the Noticed v2 milestone Oct 12, 2023
@excid3 excid3 self-assigned this Oct 12, 2023
@excid3
Copy link
Owner Author

excid3 commented Dec 23, 2023

Readd support for delays

@excid3 excid3 mentioned this pull request Dec 24, 2023
@excid3 excid3 merged commit 797878f into main Jan 15, 2024
45 checks passed
@excid3 excid3 deleted the v2 branch January 15, 2024 15:34
@jon-sully
Copy link
Contributor

Woop woop!!

Copy link
Contributor

@jon-sully jon-sully left a comment

Choose a reason for hiding this comment

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

Had a few thoughts on this from earlier this week I forgot to post. Curious for your take, @excid3! 🙏

@@ -0,0 +1,9 @@
module Noticed
class ApplicationJob < ActiveJob::Base
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure we called it out anywhere, but this gem does have a hard dependence on ActiveJob 🤔 I know there are plenty of apps out there using Sidekiq directly (for example), so this may be worth noting.

Copy link
Owner Author

Choose a reason for hiding this comment

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

We could add an explicit require for it if needed. Could also replace the dependency on Rails with ActiveRecord + ActiveJob.

app/models/concerns/noticed/deliverable.rb Show resolved Hide resolved
return false if config.has_key?(:if) && !evaluate_option(:if)
return false if config.has_key?(:unless) && evaluate_option(:unless)

deliver
Copy link
Contributor

Choose a reason for hiding this comment

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

🤔 I wish there was a way to wrap this in with_lock and ensure that this particular [notification, delivery_method] hasn't already sent. I've definitely had cases where someone got multiple messages sent due to a retrying job. I know ultimately it boils down to never truly being able to sync up the web/email POST (or etc) with the database's state... but just wanted to throw it out there!

IIRC we're not retrying jobs anyway, so maybe it's not a big deal!

Copy link
Owner Author

Choose a reason for hiding this comment

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

Long-term we can add the ability for storing the results of delivery methods on the Noticed::Notification so the delivery methods can check if they were completed already before they run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment