fix asset importer assigns asset on default channel when importing on non default channel #2801
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Adds RequestContext to asset import for collections.
The populator loads assets into collections. However, the RequestContext is not passed along. This means that if you import collections on any channel that is not default, the assets get assigned to the default channel only.
As a result a channel specific collection import fails because an empty asset array results that is assumed to be non empty, and referenced.
Resolves issue #2787
I adjusted test on the populate spec and was surprised that even on the 'populating a non-default channel' the test passed without my changes. On further inspection it seems that that test uses the default channel for its work instead of the intended channel-2. So, it seems to be not validating what it's supposed to validate. That might be because I'm running a filtered test or because the test has a somewhat unique setup that destroys the server after the additional test channel is created. Initially I thought it might a cache refresh issue but later I realized that channel-2 wasn't in the database during the test. So, writing the test became a bit of a rabbit hole and I bailed after a while. Perhaps someone can enlighten me on the test setup and how it's supposed to work.
BTW: after running npm install, testing doesn't work out of the box. had to remove package-lock.json to be able to run tests at all bc of darwin related errors on optional dependencies
Breaking changes
None
Screenshots
You can add screenshots here if applicable.
Checklist
📌 Always:
👍 Most of the time: