diff --git a/app/controllers/online_notifications_controller.rb b/app/controllers/online_notifications_controller.rb index 05412e7e1..f60977218 100644 --- a/app/controllers/online_notifications_controller.rb +++ b/app/controllers/online_notifications_controller.rb @@ -174,9 +174,9 @@ curl http://localhost/api/v1/online_notifications/mark_all_as_read -v -u #{login def mark_all_as_read notifications = OnlineNotification.list(current_user, 200) notifications.each do |notification| - if !notification['seen'] - OnlineNotification.seen(id: notification['id']) - end + next if notification['seen'] + + OnlineNotification.find(notification['id']).update!(seen: true) end render json: {}, status: :ok end diff --git a/app/models/online_notification.rb b/app/models/online_notification.rb index 958225b38..15d876256 100644 --- a/app/models/online_notification.rb +++ b/app/models/online_notification.rb @@ -61,22 +61,6 @@ add a new online notification for this user =begin -mark online notification as seen - - OnlineNotification.seen( - id: 2, - ) - -=end - - def self.seen(data) - notification = OnlineNotification.find(data[:id]) - notification.seen = true - notification.save - end - -=begin - remove whole online notifications of an object OnlineNotification.remove('Ticket', 123)