Class: Notifications::NotificationsController
Instance Method Summary
collapse
#authenticate_user!, #current_user
Instance Method Details
#clean ⇒ Object
17
18
19
20
|
# File 'app/controllers/notifications/notifications_controller.rb', line 17
def clean
notifications.delete_all
redirect_to notifications_path
end
|
#index ⇒ Object
3
4
5
6
7
8
9
10
|
# File 'app/controllers/notifications/notifications_controller.rb', line 3
def index
@notifications = notifications.includes(:actor).order("id desc").page(params[:page])
unread_ids = @notifications.reject(&:read?).select(&:id)
Notification.read!(current_user, unread_ids)
@notification_groups = @notifications.group_by { |note| note.created_at.to_date }
end
|
#read ⇒ Object
12
13
14
15
|
# File 'app/controllers/notifications/notifications_controller.rb', line 12
def read
Notification.read!(current_user, params[:ids])
render json: { ok: 1 }
end
|