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
|
else
|
||||||
flash[:notice] = I18n.t "users.update.settings_not_updated"
|
flash[:notice] = I18n.t "users.update.settings_not_updated"
|
||||||
end
|
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]
|
elsif u[:language]
|
||||||
if @user.update_attributes(u)
|
if @user.update_attributes(u)
|
||||||
I18n.locale = @user.language
|
I18n.locale = @user.language
|
||||||
|
|
@ -92,6 +86,18 @@ class UsersController < ApplicationController
|
||||||
end
|
end
|
||||||
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
|
def destroy
|
||||||
if params[:user] && params[:user][:current_password] && current_user.valid_password?(params[:user][:current_password])
|
if params[:user] && params[:user][:current_password] && current_user.valid_password?(params[:user][:current_password])
|
||||||
current_user.close_account!
|
current_user.close_account!
|
||||||
|
|
@ -194,7 +200,6 @@ class UsersController < ApplicationController
|
||||||
:invitation_service,
|
:invitation_service,
|
||||||
:invitation_identifier,
|
:invitation_identifier,
|
||||||
:show_community_spotlight_in_stream,
|
:show_community_spotlight_in_stream,
|
||||||
:strip_exif,
|
|
||||||
:auto_follow_back,
|
:auto_follow_back,
|
||||||
:auto_follow_back_aspect_id,
|
:auto_follow_back_aspect_id,
|
||||||
:remember_me,
|
:remember_me,
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
%h3
|
%h3
|
||||||
= t(".title")
|
= 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.error_messages
|
||||||
|
|
||||||
= f.fields_for :stream_preferences do
|
= f.fields_for :stream_preferences do
|
||||||
|
|
|
||||||
|
|
@ -107,11 +107,12 @@ Diaspora::Application.routes.draw do
|
||||||
end
|
end
|
||||||
|
|
||||||
controller :users do
|
controller :users do
|
||||||
get 'public/:username' => :public, :as => 'users_public'
|
get "public/:username" => :public, :as => :users_public
|
||||||
get 'getting_started' => :getting_started, :as => 'getting_started'
|
get "getting_started" => :getting_started, :as => :getting_started
|
||||||
get 'privacy' => :privacy_settings, :as => 'privacy_settings'
|
get "confirm_email/:token" => :confirm_email, :as => :confirm_email
|
||||||
get 'getting_started_completed' => :getting_started_completed
|
get "privacy" => :privacy_settings, :as => :privacy_settings
|
||||||
get 'confirm_email/:token' => :confirm_email, :as => 'confirm_email'
|
put "privacy" => :update_privacy_settings, :as => :update_privacy_settings
|
||||||
|
get "getting_started_completed" => :getting_started_completed
|
||||||
end
|
end
|
||||||
|
|
||||||
# This is a hack to overide a route created by devise.
|
# This is a hack to overide a route created by devise.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue