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

fix: avoid duplicity with linked guest authors #1632

Merged
merged 1 commit into from
Dec 22, 2023

Conversation

leogermani
Copy link
Contributor

@leogermani leogermani commented Dec 18, 2023

All Submissions:

Changes proposed in this Pull Request:

Fixes an issue with CAPs linked authors in the Hompepage posts block

How to test the changes in this Pull Request:

  1. Create a user and a guest author that share the same name
  2. Create one post authored by each of these users
  3. Edit the guest author and link them to the user with the same name
  4. On master add a new Homepage block to a page and search for the author by it name in the "authors" filter box
  5. Confirm you get two results
  6. Checkout this branch
  7. Confirm you now get only one result
  8. Confirm the posts are queried correctly and you get both posts rendered in the block

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@leogermani leogermani self-assigned this Dec 18, 2023
@leogermani leogermani requested a review from a team as a code owner December 18, 2023 21:44
Copy link
Member

@miguelpeixe miguelpeixe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was not able to reproduce the issue this is trying to fix. My steps on the master branch were:

  • Created a user "Jane Doe"
  • Created a guest user "Jane Doe"
  • Created a "Jane Doe Post" and selected both users as author
  • Edited guest user "Jane Doe" to map to the user with the same name
  • Created a homepage posts block to filter only "Jane Doe" and this is what I got:
image

I edited the created post and was surprised to see that the post no longer had 2 authors. I suspect CAP resolved that when the GA was mapped.

Looking into the original issue in Asana, I believe the problem might be related to how the AutocompleteTokenField behaves.

The component "tokens" are the input labels, so you are not able to select multiple items that share the same name. I believe this should be resolved in 2 ways (not exclusively):

  • Append a unique value to the input label, e.g. Jane Doe (#{id})
  • Prevent mapped users from rendering as an option, so you get only one option

@leogermani
Copy link
Contributor Author

Created a homepage posts block to filter only "Jane Doe" and this is what I got:

What should happen is that you will see both Janes in the dropdown. If they are not linked, that's expected, but if they are linked you should see only one.

Good idea adding the ID in the label, I'll have a look. But let me know if you can reproduce the above - and confirm the fix

@miguelpeixe
Copy link
Member

I just realized that I completely misinterpreted the PR 😅

I thought it was duplicating posts and not the authors' names. I now understand what to test.

Copy link
Member

@miguelpeixe miguelpeixe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that I understand what to test I can confirm it's working as described!

The addition to the unique value on the label would be nice but not a blocker for this.

@leogermani leogermani merged commit 608979c into master Dec 22, 2023
@leogermani leogermani deleted the fix/linked-authors-on-autocomplete branch December 22, 2023 15:20
@dkoo
Copy link
Contributor

dkoo commented Dec 22, 2023

Screenshot 2023-12-22 at 11 00 06 AM

Those sneaky guest authors... 🕵️

@leogermani
Copy link
Contributor Author

Screenshot 2023-12-22 at 11 00 06 AM

Those sneaky guest authors... 🕵️

oops, sorry for my english. Miguel got it because we speak the same language :)

@miguelpeixe
Copy link
Member

I'd never question the use of "duplicity" to mean duplicate 😆

@dkoo
Copy link
Contributor

dkoo commented Dec 22, 2023

I got what you meant, too. I actually had to look it up because I wasn't sure if my hunch was correct. 🤣

matticbot pushed a commit that referenced this pull request Dec 22, 2023
# [2.5.0-alpha.2](v2.5.0-alpha.1...v2.5.0-alpha.2) (2023-12-22)

### Bug Fixes

* avoid duplicity with linked guest authors ([#1632](#1632)) ([608979c](608979c))
* **modal-checkout:** show order details table with fees ([#1633](#1633)) ([07c0642](07c0642))

### Features

* **modal-checkout:** allow anonymous purchase for registered email ([#1615](#1615)) ([a0040b4](a0040b4))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 2.5.0-alpha.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

matticbot pushed a commit that referenced this pull request Jan 8, 2024
# [2.5.0](v2.4.0...v2.5.0) (2024-01-08)

### Bug Fixes

* avoid duplicity with linked guest authors ([#1632](#1632)) ([608979c](608979c))
* **modal-checkout:** show order details table with fees ([#1633](#1633)) ([07c0642](07c0642))

### Features

* accessibility improvements to the donate block tabs ([#1622](#1622)) ([115e9fb](115e9fb))
* **donate:** support empty value for "other" tier ([#1604](#1604)) ([61ffdbc](61ffdbc))
* **modal-checkout:** allow anonymous purchase for registered email ([#1615](#1615)) ([a0040b4](a0040b4))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 2.5.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

4 participants