1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-24 15:49:39 +02:00

Enhance member removal process by destroying associated invitations and updating flash messages in ProfilesController. Add test to verify invitation deletion upon member removal.

Fixes #2066
This commit is contained in:
Josh Pigford 2025-04-20 20:15:49 -05:00
parent 08091d24f9
commit 1b1add38f2
2 changed files with 25 additions and 3 deletions

View file

@ -23,9 +23,11 @@ class Settings::ProfilesController < ApplicationController
end
if @user.destroy
flash[:notice] = t("settings.profiles.destroy.member_removed")
# 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] = t("settings.profiles.destroy.member_removal_failed")
flash[:alert] = "Failed to remove member."
end
redirect_to settings_profile_path