mgabdev
2020-01-16 18:24:10 -05:00
parent 292991bf33
commit 7fb0b462e2
13 changed files with 91 additions and 8 deletions

View File

@@ -1,8 +1,8 @@
# frozen_string_literal: true
class Api::V1::NotificationsController < Api::BaseController
before_action -> { doorkeeper_authorize! :read, :'read:notifications' }, except: [:clear, :dismiss]
before_action -> { doorkeeper_authorize! :write, :'write:notifications' }, only: [:clear, :dismiss]
before_action -> { doorkeeper_authorize! :read, :'read:notifications' }, except: [:clear, :dismiss, :mark_read]
before_action -> { doorkeeper_authorize! :write, :'write:notifications' }, only: [:clear, :dismiss, :mark_read]
before_action :require_user!
after_action :insert_pagination_headers, only: :index
@@ -30,6 +30,11 @@ class Api::V1::NotificationsController < Api::BaseController
render_empty
end
def mark_read
current_account.notifications.find(params[:id]).mark_read!
render_empty
end
private
def load_notifications