mirror of
https://github.com/SrIzan10/hc-harbor.git
synced 2026-05-01 10:45:21 +00:00
Fix patching on user settings page
This commit is contained in:
@@ -24,7 +24,7 @@ class UsersController < ApplicationController
|
||||
if @user.uses_slack_status?
|
||||
@user.update_slack_status
|
||||
end
|
||||
redirect_to is_own_settings? ? my_settings_path : user_settings_path(@user),
|
||||
redirect_to is_own_settings? ? my_settings_path : settings_user_path(@user),
|
||||
notice: "Settings updated successfully"
|
||||
else
|
||||
flash[:error] = "Failed to update settings"
|
||||
@@ -96,7 +96,7 @@ class UsersController < ApplicationController
|
||||
end
|
||||
|
||||
def is_own_settings?
|
||||
@is_own_settings ||= !params["id"].present?
|
||||
@is_own_settings ||= params["id"] == "my" || params["id"]&.blank?
|
||||
end
|
||||
|
||||
def user_params
|
||||
|
||||
@@ -60,6 +60,7 @@ Rails.application.routes.draw do
|
||||
# Nested under users for admin access
|
||||
resources :users, only: [] do
|
||||
get "settings", on: :member, to: "users#edit"
|
||||
patch "settings", on: :member, to: "users#update"
|
||||
member do
|
||||
patch :update_trust_level
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user