Refactoring: Removed unnecessary OnlineNotification.seen method.
This commit is contained in:
parent
9c76def19d
commit
0afb105dd7
2 changed files with 3 additions and 19 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue