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

IBX-6631: Enriched TrashItem with removedLocationContentIdMap #388

Merged
merged 4 commits into from
Oct 19, 2023

Conversation

barw4
Copy link
Member

@barw4 barw4 commented Oct 12, 2023

Question Answer
JIRA issue IBX-6631
Type improvement
Target Ibexa version v3.3
BC breaks no

Related PR: https://github.com/ezsystems/date-based-publisher/pull/267

One assert was removed because crucial values are compared in the same method which makes this assert obsolete. Obviously, it also fails as loaded TrashItem will always have an empty removedLocationContentIdMap whether the one built after trashing - won't.

Checklist:

  • Provided PR description.
  • Tested the solution manually.
  • Provided automated test coverage.
  • Checked that target branch is set correctly (master for features, the oldest supported for bugs).
  • Ran PHP CS Fixer for new PHP code (use $ composer fix-cs).
  • Asked for a review (ping @ezsystems/engineering-team).

@barw4 barw4 added Improvement Changes not fixing or changing behavior Ready for review labels Oct 12, 2023
@barw4 barw4 self-assigned this Oct 12, 2023
@barw4 barw4 requested review from alongosz and a team October 12, 2023 08:55
Copy link
Member

@alongosz alongosz left a comment

Choose a reason for hiding this comment

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

@barw4 this is very good, but as usual, I need some integration test coverage to see that those subtree IDs land there properly in that API TrashItem Value ;)

@alongosz alongosz requested a review from a team October 13, 2023 09:30
@barw4 barw4 requested a review from alongosz October 13, 2023 12:22
@barw4
Copy link
Member Author

barw4 commented Oct 13, 2023

@alongosz test added in 48730c1

@sonarcloud
Copy link

sonarcloud bot commented Oct 13, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@alongosz alongosz requested a review from a team October 16, 2023 08:03
@konradoboza konradoboza requested a review from a team October 16, 2023 08:11
/**
* @return array<int, int>
*/
public function getRemovedLocationContentIdMap(): array
Copy link
Contributor

Choose a reason for hiding this comment

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

In https://github.com/ezsystems/date-based-publisher/pull/267 I see that you are using this map to create content deletion notifications, and perform actual deletions.

Note that Content can have multiple locations, which means the same Content ID might occur in this map multiple times. Is this your intent?

Copy link
Member Author

@barw4 barw4 Oct 16, 2023

Choose a reason for hiding this comment

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

@Steveb-p Yes, it can appear multiple times. Why would that be a problem? If one schedule entry is deleted, the second one won't be found and hence, won't be deleted. No exception is being thrown.

Copy link
Contributor

@Steveb-p Steveb-p Oct 16, 2023

Choose a reason for hiding this comment

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

If that is the case, then it is ok. I assumed it was a case that was not taken into account and the same action was taken for the same Content ID more than once.

You may consider swapping the map order. By having it be array<ContentID, array<LocationID>> (array with ContentID as keys and an array of LocationIDs as value) you would have a similar effect, with Location IDs being grouped together. Only a suggestion though, of course.

Copy link

@tomaszszopinski tomaszszopinski left a comment

Choose a reason for hiding this comment

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

QA approved on IbexaDXP 3.3 commerce.

@alongosz alongosz merged commit 336f0a6 into 1.3 Oct 19, 2023
26 checks passed
@alongosz alongosz deleted the ibx-6631-TrashItem-removed-locations-map branch October 19, 2023 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Improvement Changes not fixing or changing behavior QA approved
Development

Successfully merging this pull request may close these issues.

6 participants