Mark read notifications as read after migrating to conversations

This commit is contained in:
Brenda Wallace committed 2019-08-11 15:50:36 +12:00
1 parent 031734bb7f
commit c4b33db495
2 files changed
+5 -2

No files matched your search

+1 -1
View File
@@ -7,7 +7,7 @@ Mailboxer.setup do |config|
# Configures the methods needed by mailboxer
# config.email_method = :email
# config.name_method = :login_name
config.name_method = :login_name
config.notify_method = :notify
# Configures if you use or not a search engine and which one you are using
@@ -7,7 +7,10 @@ class NotificationsToMailboxer < ActiveRecord::Migration[5.2]
Notification.find_in_batches.each do |group|
group.each do |n|
n.body = 'message has no body' if n.body.blank?
n.send_message
receipt = n.send_message
next unless n.read
receipt.conversation.receipts.each(&:mark_as_read)
end
end
end