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

[5.x]: Nested addresses owned by a custom field can appear in the wrong context #15678

Closed
AugustMiller opened this issue Sep 5, 2024 · 2 comments
Assignees
Labels

Comments

@AugustMiller
Copy link
Contributor

What happened?

Description

I think this is two distinct issues:

  1. Address elements nested within a custom field on a user can appear in the main "Addresses" view.
  2. After deleting an address field, the fieldId is not cleaned up, nor are the nested elements deleted.

Running garbage collection didn't seem to help, but this resave command took care of it:

ddev craft resave/addresses --element-id [[offending address ID]] --set fieldId --to "fn(\$element) => null"

Steps to reproduce

  1. Create an Addresses field;
  2. Add it to the User Profile field layout;
  3. Create a nested address element on a user;
  4. Observe that new address in the Addresses screen (despite it being owned by a custom field);

Additionally:

  1. Delete the custom Addresses field;
  2. View the Addresses screen for the same user;
  3. Observe error about a missing field;

Expected behavior

Addresses owned by custom fields are excluded from the native address list. (I think?)

Actual behavior

Addresses owned by custom fields leak into native address list.

Craft CMS version

5.4.1

PHP version

8.2.20

Operating system and version

macOS/Docker

Database type and version

MySQL 8.0.36

Image driver and version

No response

Installed plugins and versions

No response

@i-just
Copy link
Contributor

i-just commented Sep 6, 2024

Thanks for the clear description, August! I raised a PR for this.

@brandonkelly
Copy link
Member

Fixed in 5.4.2!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants