- Support callbacks in bulk delivery methods.
- Add translation and URL helpers to Ephemeral notifiers & notifications #485
- The
parent_class
configuration now also changes the parent class forNoticed::EventJob
. #483 - Include translation support in Ephemeral notifications #484
- Include private methods when checking if respond_to?(:method). Fixes #475
- Add
recipients
feature to let Notifiers determine their recipients
class CommentNotifier < ApplicationNotifier
# Notify all the commenters on this post except the new comment author
# Can be given a lambda or Proc
recipients ->{ params[:comment].post.commenters.excluding(params[:comment].user).distinct }
# Can be given a block
recipients do
params[:comment].post.commenters.excluding(params[:comment].user).distinct
end
# Or can call a method
recipients :fetch_recipients
def fetch_recipients
params[:comment].post.commenters.excluding(params[:comment].user).distinct
end
end
- Use
public_send
for Email delivery so it doesn't accidentally call private methods.
- Set
:json
type on:params
column with default to better integrate with ActiveRecord. This fixes sqlserver (and probably other databases). #451
- Skip
ApplicationNotifier
in generator if it already exists
- Add
error_handler
to Twilio delivery method #444 - Fix
record
being removed forEphemeral
notifications #448
fetch_constant
will now constantize Strings returned from procs or method calls
fetch_constant
used by Email and ActionCable delivery methods now support procs and method calls with symbols like other options
- Add
config.before_enqueue
callback This callback can be used to skip enqueuing delivery methods:
class CommentNotifier < Noticed::Event
deliver_by :email do |config|
config.before_enqueue = ->{ throw(:abort) unless recipient.email_notifications? }
end
end
- Fix iOS
format
option with Symbols. This now passes thenotification
andapn
objects instead of just theapn
.
config.format = :ios_format
# ...
def ios_format(notification, apn)
end
- Re-add
deserialize_error?
toNoticed::Event
- Stringify keys for Twilio Messaging json
- Fix counter cache migration version for older Rails
- Fix duplicate column in migrations.
- Add compatibility for apps that don't use ActionCable.
[!IMPORTANT] Run rails noticed:install:migrations
to upgrade to this version
- Add
notifications_count
counter cache to Noticed::Event. - Add
has_noticed_notifications
for backwards compatibility. - Add
Noticed::Ephemeral
notifiers that skip the database records. These use ActiveModel to simulate Notifiers in memory and should work the same as a regular Notifier.
- Add
param(s)
anddeliver_later
back with deprecations where necessary to ease upgrading from v1
mark_as_read
and other class methods will now writeupdated_at
as well to bust caches
- Validate param key exists, not the value
- Fix recipients that are STI models by storing base class name
- Re-add delivery method callbacks
- Notifier generator now ensures the
Notifier
suffix.
rails g noticed:notifier Example #=> app/notifiers/example_notifier.rb
rails g noticed:notifier ExampleNotifier #=> app/notifiers/example_notifier.rb
- Delivery method options set to a Symbol will now pass the
notification
argument when calling the method instead of the delivery method instance.
class CommentNotifier
deliver_by :email do
config.if = :prefers_email?
end
def prefers_email?(notification)
notification.recipient.preferences[:email]
end
end
- Add
Noticed::NotificationChannel
and change defaults for ActionCable deliveries to this channel and stream torecipient
- Include
notification
andrecipient
in email params. Fixes #366
- [Breaking] Noticed now provides its own models for managing notifications. Migrate existing model(s) to use the new Noticed tables.
TODO - add migration example
- [Breaking] Noticed::NotificationChannel has been removed. Use an ActionCable channel in your application instead.
- [Breaking] Twilio has been renamed to
twilio_messaging
to provide support for other Twilio services in the future. - [Breaking] Vonage / Nexmo has been renamed to
vonage_sms
to provide support for other Vonage services in the future.
class NotificationChannel < ApplicationCable::Channel
def subscribed
stream_for current_user
end
def unsubscribed
stop_all_streams
end
end
Notifications
have now been renamed toNotifiers
and now inherit from the- Email delivery method now supports args
- Support html safe translations for Rails 7+
- Fix
debug
andignore_failure
options inpost
requests. #284 - @mike-burns - Add
logger
option to delivery methods to allow overriding the logger (defaults toRails.logger
) - @excid3
- Improve deprecation fix to include Rails 7.1.0.alpha and higher
- Fix overridden
Object#method
inNoticed::DeliveryMethods::Email
- @quadule - Fix Rails 7.1 deprecation warning #281 - @excid3
- Catch deserialization errors. Instead of raising an ActiveRecord::RecordNotFound error, Noticed will replace params with information about the error.
{:noticed_error=>"Couldn't find Account with 'id'=100000", :original_params=>{"foo"=>"bar", "account"=>{"_aj_globalid"=>"gid://dummy/Account/100000"}, "_aj_symbol_keys"=>["account"]}}
- Add
deserialize_error?
method to Noticed::Model for detecting if a model had issues deserializing params. You can use this method to clean up invalid notifications.
- Add dynamic delay option support - @excid3
- Check FCM response code correctly - @HeshamMagdy97
- Cleanup device token on 404 (Unregistered) error only and raise on all other error codes - @cjilbert504
- Add Firebase Cloud Messaging (FCM) delivery method - @cjilbert504 @excid3
- Support
File
andStringIO
objects for iOScert_path
- @erbunao
- Fix
recipient
assignment - @clinejj
- Add symbol support for
development
option for iOS deliveries - @joemasilotti
- Rescue from database connection errors when loading Noticed::Model #121 - @adriancb
- Fix
record
assignment - @leighhalliday
- Add iOS Apple Push Notifications - @excid3 @joemasilotti
- Customizable stream name for ActionCable deliveries - @excid3
- Set recipient when rehydrating notification objects from the database - @RolandStuder
- Support postgis database in model generator - @bmorrall @csutter
- Allow string, symbol, or class for
mailer
option with email delivery - @excid3 - Parameterless notification helpers - @SirRawlins
- Add enqueue option to email delivery method - @coder2000
- Fix early db access by moving constant lookup into the method. Fixes the situation of compiling assets needing database access. - @excid3
- Add Rails 5.2 support. Backports ActiveJob and ActionCable functionality for compatibility. - @lorint & @excid3
- Add
queue
option for delivery methods - @iheanyi
- Safely handle choosing coder when database or table doesn't exist - @excid3
- Add
has_noticed_notifications
helper for models - @excid3 - Use
json
column for params on SQLite by default instead of text - @excid3 - Add Ruby 3.0 to CI - @excid3
- [NEW] Delegate
read?
andunread?
in notification objects to the database record - @excid3 - [NEW] Always merge
recipient
andrecord
into email params - @silva96
- [NEW] Add
Notification.mark_as_unread!
class method - @excid3
- [FIX] Database delivery can't be delayed, otherwise the database record won't be available for the other deliveries - @rbague
- [NEW] Add
delay
option to delay the delivery of a specific delivery method - @rbague
- [NEW] Microsoft Teams delivery method - @jordanbrock
- [NEW] Add
mark_as_unread!
instance method forNotification
model - @pdunleav
- [FIX] Ensure
json
is used by MySQL forparams
column in generator - @mikelkew - [NEW] Update generator to add index for
read_at
column - @mikelkew - [NEW] Add
option
andoptions
for validating Delivery Method options - @rbague
- [FIX] Autoload ActionCable channel so Noticed can be used without ActionCable
- [FIX] Add
params
so delivery methods can access them without going throughnotification
- [NEW] Validate that delivery by emails (
deliver_by :email
) always have a mailer specified - [NEW] Allow validating options in custom delivery methods
- [FIX] Add
null: false
totype
column in Notification migration
- [NEW] Add
noticed:delivery_method
generator to create custom delivery methods
- [FIX] Use ActiveRecord configuration to detect adapter without establishing a database connection
- [NEW] Add Noticed::TextCoder for databases without json support
- [NEW] Update generator to make params column json for MySQL, jsonb for Postgres, and text for everything else
- [FIX] Keyword args warning for delivery methods is now fixed
- [FIX] Recipient is available in
if
&else
options
- [FIX] Use form data when sending to Twilio
- [NEW] Add i18n_scope - @rbague
- [NEW] Add
params
for specifying multiple required params - @rbague - [NEW] Allow passing in object or string for action_cable channel option - @excid3
- [FIX] Skip JSON parse if deserializing was already done - @excid3
- [FIX] Fix Slack default params #13 - @itsderek23
- [FIX] Improve serializer to handle text, json, and jsonb columns
- Include
record
in email params by default
- Adds
recipient
method on notification so they can access it during delivery. Useful when formatting to include recipient details - Merge
recipient
into params by default when delivering email notifications
- [FIX] Remove duplicates when delivering notification to multiple receipients
- [NEW] Allow delivering notification to multiple recipients
- Translation helpers
- Allow notification objects to call Rails url helpers directly
- Add
noticed:notification
generator - Allow changing database association name with
deliver_by :database, association: :notifications
- Add
Noticed::Model
concern for database notifications - Add notification database model generator
- Callbacks for notification around delivery
- Callbacks for delivery methods around delivery
- Initial release