Feature: Add new notification settings for user (#569)
Added new notification settings API for user Co-authored-by: Sojan Jose <sojan@pepalo.com>
This commit is contained in:
parent
bbd9968d4b
commit
7f26b34b15
15 changed files with 418 additions and 224 deletions
|
@ -44,7 +44,7 @@ class Api::V1::CallbacksController < Api::BaseController
|
|||
end
|
||||
|
||||
def update_fb_page(fb_page_id, access_token)
|
||||
get_fb_page(fb_page_id)&.update_attributes!(
|
||||
get_fb_page(fb_page_id)&.update!(
|
||||
user_access_token: @user_access_token, page_access_token: access_token
|
||||
)
|
||||
end
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
class Api::V1::User::NotificationSettingsController < Api::BaseController
|
||||
before_action :set_user, :load_notification_setting
|
||||
|
||||
def show; end
|
||||
|
||||
def update
|
||||
update_flags
|
||||
@notification_setting.save!
|
||||
render action: 'show'
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_user
|
||||
@user = current_user
|
||||
end
|
||||
|
||||
def load_notification_setting
|
||||
@notification_setting = @user.notification_settings.find_by(account_id: current_account.id)
|
||||
end
|
||||
|
||||
def notification_setting_params
|
||||
params.require(:notification_settings).permit(selected_email_flags: [])
|
||||
end
|
||||
|
||||
def update_flags
|
||||
@notification_setting.selected_email_flags = notification_setting_params[:selected_email_flags]
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue