Skip to content

Commit

Permalink
Refactoring: Removed unnecessary OnlineNotification.seen method.
Browse files Browse the repository at this point in the history
  • Loading branch information
thorsteneckel committed Sep 5, 2019
1 parent 9c76def commit 0afb105
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 19 deletions.
6 changes: 3 additions & 3 deletions app/controllers/online_notifications_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ def destroy
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
Expand Down
16 changes: 0 additions & 16 deletions app/models/online_notification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,22 +61,6 @@ def self.add(data)

=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)
Expand Down

0 comments on commit 0afb105

Please sign in to comment.