Refactoring: Removed unnecessary OnlineNotification.seen method.

This commit is contained in:
Thorsten Eckel 2019-09-05 15:52:25 +02:00
parent 9c76def19d
commit 0afb105dd7
2 changed files with 3 additions and 19 deletions

View file

@ -174,9 +174,9 @@ curl http://localhost/api/v1/online_notifications/mark_all_as_read -v -u #{login
def mark_all_as_read def mark_all_as_read
notifications = OnlineNotification.list(current_user, 200) notifications = OnlineNotification.list(current_user, 200)
notifications.each do |notification| notifications.each do |notification|
if !notification['seen'] next if notification['seen']
OnlineNotification.seen(id: notification['id'])
end OnlineNotification.find(notification['id']).update!(seen: true)
end end
render json: {}, status: :ok render json: {}, status: :ok
end end

View file

@ -61,22 +61,6 @@ add a new online notification for this user
=begin =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 remove whole online notifications of an object
OnlineNotification.remove('Ticket', 123) OnlineNotification.remove('Ticket', 123)