scinote-web/app/controllers/client_api/notifications_controller.rb
2017-10-06 10:45:22 +02:00

28 lines
771 B
Ruby

module ClientApi
class NotificationsController < ApplicationController
def recent_notifications
respond_to do |format|
format.json do
render template: '/client_api/notifications/index',
status: :ok,
locals: {
notifications:
UserNotification.recent_notifications(current_user)
}
end
end
# clean the unseen notifications
UserNotification.seen_by_user(current_user)
end
def unread_notifications_count
respond_to do |format|
format.json do
render json: {
count: UserNotification.unseen_notification_count(current_user)
}, status: :ok
end
end
end
end
end