fix privacy settings form submit
This commit is contained in:
parent
37837b3f73
commit
86e75a02bb
3 changed files with 19 additions and 13 deletions
|
|
@ -40,12 +40,6 @@ class UsersController < ApplicationController
|
|||
else
|
||||
flash[:notice] = I18n.t "users.update.settings_not_updated"
|
||||
end
|
||||
elsif u[:strip_exif]
|
||||
if @user.update_attributes(u)
|
||||
flash[:notice] = I18n.t "users.update.settings_updated"
|
||||
else
|
||||
flash[:notice] = I18n.t "users.update.settings_not_updated"
|
||||
end
|
||||
elsif u[:language]
|
||||
if @user.update_attributes(u)
|
||||
I18n.locale = @user.language
|
||||
|
|
@ -92,6 +86,18 @@ class UsersController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def update_privacy_settings
|
||||
privacy_params = params.fetch(:user).permit(:strip_exif)
|
||||
|
||||
if current_user.update_attributes(strip_exif: privacy_params[:strip_exif])
|
||||
flash[:notice] = t("users.update.settings_updated")
|
||||
else
|
||||
flash[:error] = t("users.update.settings_not_updated")
|
||||
end
|
||||
|
||||
redirect_to :back
|
||||
end
|
||||
|
||||
def destroy
|
||||
if params[:user] && params[:user][:current_password] && current_user.valid_password?(params[:user][:current_password])
|
||||
current_user.close_account!
|
||||
|
|
@ -194,7 +200,6 @@ class UsersController < ApplicationController
|
|||
:invitation_service,
|
||||
:invitation_identifier,
|
||||
:show_community_spotlight_in_stream,
|
||||
:strip_exif,
|
||||
:auto_follow_back,
|
||||
:auto_follow_back_aspect_id,
|
||||
:remember_me,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
%h3
|
||||
= t(".title")
|
||||
|
||||
= form_for current_user, url: user_path, html: {method: :put} do |f|
|
||||
= form_for current_user, url: update_privacy_settings_path, html: {method: :put} do |f|
|
||||
= f.error_messages
|
||||
|
||||
= f.fields_for :stream_preferences do
|
||||
|
|
|
|||
|
|
@ -107,11 +107,12 @@ Diaspora::Application.routes.draw do
|
|||
end
|
||||
|
||||
controller :users do
|
||||
get 'public/:username' => :public, :as => 'users_public'
|
||||
get 'getting_started' => :getting_started, :as => 'getting_started'
|
||||
get 'privacy' => :privacy_settings, :as => 'privacy_settings'
|
||||
get 'getting_started_completed' => :getting_started_completed
|
||||
get 'confirm_email/:token' => :confirm_email, :as => 'confirm_email'
|
||||
get "public/:username" => :public, :as => :users_public
|
||||
get "getting_started" => :getting_started, :as => :getting_started
|
||||
get "confirm_email/:token" => :confirm_email, :as => :confirm_email
|
||||
get "privacy" => :privacy_settings, :as => :privacy_settings
|
||||
put "privacy" => :update_privacy_settings, :as => :update_privacy_settings
|
||||
get "getting_started_completed" => :getting_started_completed
|
||||
end
|
||||
|
||||
# This is a hack to overide a route created by devise.
|
||||
|
|
|
|||
Loading…
Reference in a new issue