Class: ActiveJob::Notificare::NotificationsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/active_job/notificare/notifications_controller.rb

Instance Method Summary collapse

Instance Method Details

#clearObject



23
24
25
26
27
28
29
30
# File 'app/controllers/active_job/notificare/notifications_controller.rb', line 23

def clear
  @notifications = Notification.where(recipient: @current_recipient).visible.to_a
  Notification.where(id: @notifications.map(&:id)).destroy_all
  respond_to do |format|
    format.turbo_stream
    format.html { head :ok }
  end
end

#dismissObject



15
16
17
18
19
20
21
# File 'app/controllers/active_job/notificare/notifications_controller.rb', line 15

def dismiss
  @notification.dismiss!
  respond_to do |format|
    format.turbo_stream
    format.html { head :ok }
  end
end

#readObject



7
8
9
10
11
12
13
# File 'app/controllers/active_job/notificare/notifications_controller.rb', line 7

def read
  @notification.mark_read!
  respond_to do |format|
    format.turbo_stream
    format.html { head :ok }
  end
end