Properly match notification type
This commit is contained in:
parent
b3f15fe409
commit
28240bba27
|
@ -31,7 +31,7 @@ class Notification < ApplicationRecord
|
|||
notif_type = target.notification_type
|
||||
return nil unless notif_type
|
||||
|
||||
notif = notif_type.find_by(recipient: recipient, target: target)
|
||||
notif = Notification.find_by(recipient: recipient, target: target)
|
||||
notif.destroy unless notif.nil?
|
||||
end
|
||||
|
||||
|
@ -39,7 +39,6 @@ class Notification < ApplicationRecord
|
|||
|
||||
def make_notification(recipient, target, notification_type)
|
||||
n = notification_type.new(target: target,
|
||||
target_type: target.class.name, # To ensure we don't get a type of 'Appenddable'
|
||||
recipient: recipient,
|
||||
new: true)
|
||||
n.save!
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
- else
|
||||
- notifications.each do |notification|
|
||||
.dropdown-item
|
||||
= render "notifications/type/#{notification.target_type.downcase.split('::').last}", notification: notification
|
||||
= render "notifications/type/#{notification.target.type.downcase.split('::').last}", notification: notification
|
||||
|
||||
%a.dropdown-item.text-center{ href: notifications_path }
|
||||
%i.fa.fa-fw.fa-chevron-right
|
||||
|
|
Loading…
Reference in New Issue