Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

As super admin, cannot delete users without orders #12453

Closed
BethanOFN opened this issue May 9, 2024 · 3 comments
Closed

As super admin, cannot delete users without orders #12453

BethanOFN opened this issue May 9, 2024 · 3 comments
Assignees

Comments

@BethanOFN
Copy link

Description

Trying to delete a user account as super admin for a user with no orders, who does not appear in any customer lists, triggers a 500 snail error

Expected Behavior

Super admins should be able to delete user accounts who have no associated orders/links to other tables in the database as there are no dependencies. The delete button should be usable for at least some users.

Actual Behaviour

Clicking delete triggers a 500 snail error. No users can therefore be deleted.

Steps to Reproduce

  1. Go to Users screen on UK prod
  2. Search user email associated with user id 222887
  3. Delete user
  4. Observe 500 snail error

Animated Gif/Screenshot

Workaround

Severity

bug-s3 The delete button is currently completely unusable. Workaround is to replace with dummy email when user requests their account to be deleted, but this does nothing to reduce database load. We have around 32,000 user accounts in UK who've never placed an order.

Your Environment

  • Version used:
  • Browser name and version:
  • Operating System and version (desktop or mobile):

Possible Fix

@abdellani abdellani self-assigned this May 9, 2024
@abdellani
Copy link
Member

@BethanOFN

I was checking the logs
This user has at least one order (maybe in progress)

PG::ForeignKeyViolation: ERROR:  update or delete on table "spree_users" violates foreign key constraint "fk_rails_8d07181998" on table "spree_orders"
DETAIL:  Key (id)=(222887) is still referenced from table "spree_orders".

do we want in this case remove the orders that belongs to that user?

@abdellani
Copy link
Member

abdellani commented May 17, 2024

I think that's not a bug except if we want to allow deleting users who only have in-progress orders.
what do you think @openfoodfoundation/testers ?

@RachL
Copy link
Contributor

RachL commented May 17, 2024

Indeed it's not a bug @abdellani we need to be able to soft delete users, but that's a feature request. @BethanOFN feel free to reopen if you think otherwise.

@RachL RachL closed this as completed May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

3 participants