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
|
notif_type = target.notification_type
|
||||||
return nil unless notif_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?
|
notif.destroy unless notif.nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -39,7 +39,6 @@ class Notification < ApplicationRecord
|
||||||
|
|
||||||
def make_notification(recipient, target, notification_type)
|
def make_notification(recipient, target, notification_type)
|
||||||
n = notification_type.new(target: target,
|
n = notification_type.new(target: target,
|
||||||
target_type: target.class.name, # To ensure we don't get a type of 'Appenddable'
|
|
||||||
recipient: recipient,
|
recipient: recipient,
|
||||||
new: true)
|
new: true)
|
||||||
n.save!
|
n.save!
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
- else
|
- else
|
||||||
- notifications.each do |notification|
|
- notifications.each do |notification|
|
||||||
.dropdown-item
|
.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 }
|
%a.dropdown-item.text-center{ href: notifications_path }
|
||||||
%i.fa.fa-fw.fa-chevron-right
|
%i.fa.fa-fw.fa-chevron-right
|
||||||
|
|
Loading…
Reference in New Issue