Browse Source

Refactoring: Removed unnecessary OnlineNotification.seen method.

Thorsten Eckel 5 years ago
parent
commit
0afb105dd7

+ 3 - 3
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

+ 0 - 16
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)