Commit 968809dc authored by James Lopez's avatar James Lopez

fix profiles controller

parent aa158dd7
...@@ -14,7 +14,7 @@ class ProfilesController < Profiles::ApplicationController ...@@ -14,7 +14,7 @@ class ProfilesController < Profiles::ApplicationController
respond_to do |format| respond_to do |format|
result = Users::UpdateService.new(current_user, @user, user_params).execute result = Users::UpdateService.new(current_user, @user, user_params).execute
if result[:success] if result[:status] == :success
message = "Profile was successfully updated" message = "Profile was successfully updated"
format.html { redirect_back_or_default(default: { action: 'show' }, options: { notice: message }) } format.html { redirect_back_or_default(default: { action: 'show' }, options: { notice: message }) }
...@@ -65,7 +65,7 @@ class ProfilesController < Profiles::ApplicationController ...@@ -65,7 +65,7 @@ class ProfilesController < Profiles::ApplicationController
def update_username def update_username
result = Users::UpdateService.new(current_user, @user, username: user_params[:username]).execute result = Users::UpdateService.new(current_user, @user, username: user_params[:username]).execute
options = if result[:success] options = if result[:status] == :success
{ notice: "Username successfully changed" } { notice: "Username successfully changed" }
else else
{ alert: "Username change failed - #{result[:message]}" } { alert: "Username change failed - #{result[:message]}" }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment