2015-05-05 03:10:25 +02:00
|
|
|
class API::NotificationsController < API::ApiController
|
|
|
|
include NotifyWith::NotificationsApi
|
|
|
|
before_action :authenticate_user!
|
|
|
|
|
|
|
|
def index
|
|
|
|
if params[:is_read]
|
2016-12-19 17:08:11 +01:00
|
|
|
if params[:is_read] == 'true'
|
|
|
|
@notifications = current_user.notifications.where(is_read: true).page(params[:page]).per(15).order('created_at DESC')
|
|
|
|
else
|
|
|
|
@notifications = current_user.notifications.where(is_read: false).order('created_at DESC')
|
|
|
|
end
|
2015-05-05 03:10:25 +02:00
|
|
|
else
|
|
|
|
@notifications = current_user.notifications.order('created_at DESC')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|