Add new user settings pages for Chat and Wallet

This commit is contained in:
Râu Cao
2023-04-04 12:28:32 +02:00
parent 23821f9e65
commit f19baaf22a
5 changed files with 71 additions and 4 deletions

View File

@@ -12,6 +12,13 @@ class SettingsController < ApplicationController
end
def update
@user = current_user
@user.preferences.merge! user_params[:preferences]
@user.save!
redirect_to setting_path(@settings_section), flash: {
success: 'Settings saved.'
}
end
def reset_password
@@ -29,10 +36,17 @@ class SettingsController < ApplicationController
def set_settings_section
@settings_section = params[:section]
allowed_sections = [:profile, :account, :notifications]
allowed_sections = [:profile, :account, :lightning, :xmpp]
unless allowed_sections.include?(@settings_section.to_sym)
redirect_to setting_path(:profile)
end
end
def user_params
params.require(:user).permit(preferences: [
lightning: [:notify_sats_received],
xmpp: [:exchange_contacts_with_invitees]
])
end
end