mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-12-11 22:24:21 +01:00
14 lines
852 B
Ruby
14 lines
852 B
Ruby
json.array!(@notifications) do |notification|
|
|
if Module.const_get(notification.attached_object_type) and notification.attached_object # WHY WERE WE DOING Object.const_defined?(notification.attached_object_type) ??? Why not just deleting obsolete notifications ?! Object.const_defined? was introducing a bug! Module.const_get is a TEMPORARY fix, NOT a solution
|
|
json.extract! notification, :id, :notification_type_id, :notification_type, :created_at, :is_read
|
|
json.attached_object notification.attached_object
|
|
json.message do
|
|
if notification.notification_type.nil?
|
|
json.partial! 'api/notifications/undefined_notification', notification: notification
|
|
else
|
|
json.partial! "/api/notifications/#{notification.notification_type}", notification: notification
|
|
end
|
|
end
|
|
end
|
|
end.delete_if {|n| n['id'] == nil }
|