solidus icon indicating copy to clipboard operation
solidus copied to clipboard

Breadcrumbs displays invalid emails modifying users

Open kennyadsl opened this issue 5 years ago • 1 comments

When changing a user's email in the backend (/admin/users/:id), if there is a validation error on the email, breadcrumbs of the page are updated with the wrong, invalid value.

Solidus Version:

master

To Reproduce

In sandbox:

  1. Go to Admin -> User -> Any user -> Account tab
  2. Change user's email with the email taken by another user and save
  3. Click Update button

Current behavior

Breadcrumbs are updated with the wrong email, even if there's an error on the page

Expected behavior

The old, persisted and valid email is displayed in breadcrumbs

Screenshots

breadcrumbs-bug

👆 I'm actually editing [email protected]

Additional context

I suppose this happens because breacrumbs is using the ivar (maybe @user, or @object from Spree::Admin::ResourceController) that contains the instance of the User with errors (and previously submitted params) and not the persisted one, which is valid.

I'm afraid this could happen in other pages as well, where the value that the user is trying to change to an invalid one is used to create breadcrumbs of that page.

kennyadsl avatar Mar 18 '19 22:03 kennyadsl

@kennyadsl I'm not sure if this is the best approach to tackle this issue, but here is a possible solution https://github.com/solidusio/solidus/pull/3152

jtapia avatar Mar 21 '19 22:03 jtapia

A PR was accepted to fix an edge case, and we are closing this because we are in the process of building a new version of the Solidus Admin, which will make this issue soon irrelevant.

chrean avatar Dec 27 '22 15:12 chrean