Skip to content

Remove newly added terms before processing#8312

Merged
sebastienros merged 1 commit into
OrchardCMS:devfrom
Lawyerson:patch-2
Jan 23, 2020
Merged

Remove newly added terms before processing#8312
sebastienros merged 1 commit into
OrchardCMS:devfrom
Lawyerson:patch-2

Conversation

@Lawyerson

Copy link
Copy Markdown
Contributor

// Remove the newly added terms because they will get processed by the Published-Event termList.RemoveAll(t => t.Term.Id == term.Id);

This code on line 284 of the TaxonomyService claims to remove newly added terms, because they will be processed by their own published event anyway. I don't think it's currently doing that however, since it's comparing the id of the TermPart to the id of the TermContentItem record. This is unlikely to cause any issues besides some overhead, but there is a theoretical edge case where a TermContentItem could have the same id as an existing term, causing that term not to update.

I believe this is what was intended:
termList.RemoveAll(t => t.Term.TermRecord.Id == term.Id);

`// Remove the newly added terms because they will get processed by the Published-Event
                termList.RemoveAll(t => t.Term.Id == term.Id);`

This line on 284 of the TaxonomyService claims to remove newly added terms, because they will be processed by their own published event anyway. I don't think it's currently doing that however, since it's comparing the id of the TermPart to the id of the TermContentItem record. This is unlikely to cause any issues besides some overhead, but there is a theoretical edge case where a TermContentItem could have the same id as an existing term, causing that term not to be processed at all.

I believe this is what was intended:
`termList.RemoveAll(t => t.Term.TermRecord.Id == term.Id);`

@MatteoPiovanelli MatteoPiovanelli left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this is correct

@sebastienros
sebastienros merged commit 92773eb into OrchardCMS:dev Jan 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants