scinote-web/app/controllers/client_api/notifications_controller.rb
2017-08-08 15:44:28 +02:00

24 lines
609 B
Ruby

module ClientApi
class NotificationsController < ApplicationController
before_action :last_notifications, only: :recent_notifications
def recent_notifications
respond_to do |format|
format.json do
render template: '/client_api/notifications/index',
status: :ok,
locals: { notifications: @recent_notifications }
end
end
end
private
def last_notifications
@recent_notifications =
UserNotification.recent_notifications(current_user)
UserNotification.seen_by_user(current_user)
end
end
end