mirror of
https://github.com/we-promise/sure.git
synced 2026-04-07 22:34:47 +00:00
* Reshuffle/organize settings UI * Settings: AI prompt display/minor touch-ups * API key settings tests * Moved import/export together * Collapsible LLM prompt DIVs * Add export tests
40 lines
1.0 KiB
Ruby
40 lines
1.0 KiB
Ruby
class Settings::ProfilesController < ApplicationController
|
|
layout "settings"
|
|
|
|
def show
|
|
@user = Current.user
|
|
@users = Current.family.users.order(:created_at)
|
|
@pending_invitations = Current.family.invitations.pending
|
|
@breadcrumbs = [
|
|
[ "Home", root_path ],
|
|
[ "Profile Info", nil ]
|
|
]
|
|
end
|
|
|
|
def destroy
|
|
unless Current.user.admin?
|
|
flash[:alert] = t("settings.profiles.destroy.not_authorized")
|
|
redirect_to settings_profile_path
|
|
return
|
|
end
|
|
|
|
@user = Current.family.users.find(params[:user_id])
|
|
|
|
if @user == Current.user
|
|
flash[:alert] = t("settings.profiles.destroy.cannot_remove_self")
|
|
redirect_to settings_profile_path
|
|
return
|
|
end
|
|
|
|
if @user.destroy
|
|
# Also destroy the invitation associated with this user for this family
|
|
Current.family.invitations.find_by(email: @user.email)&.destroy
|
|
flash[:notice] = "Member removed successfully."
|
|
else
|
|
flash[:alert] = "Failed to remove member."
|
|
end
|
|
|
|
redirect_to settings_profile_path
|
|
end
|
|
end
|