Skip to content

Conversation

@rs-amp
Copy link
Contributor

@rs-amp rs-amp commented Mar 9, 2022

Fixes an issue where content-item import would return true if you answered n to any question before the import started, or an error occurred within prepareContentForImport. This meant that it would assume that the import succeeded, and for content-item move this would move onto the next step and archive the content from the source.

Now when this happens, the method returns false, a message is logged indicating that the import was aborted, and the source content is not archived.

Also fixes an issue where dependent content, or content skipped on import would be archived in the source on move, when it really shouldn't have been.

This chances the semantics of exportedIds, and adds a new importedIds for the import command:

  • exportedIds now only includes content that was selected by the input query. Dependencies are specifically excluded from the array, as the user didn't intend to select them.
  • importedIds is a new field populated with a list of source ids of content that was imported into the destination repository, after skips and other content processing.

The move command has been changed so that it only archives content in the source that is present in both lists. That is, the content was specifically selected by the user (not copied as a required dependency only) and has not been excluded from the import is considered "moved" and is archived. These rules also apply to content marked as moved in the revert log, so reverting should also behave with the new rules.

@rs-amp rs-amp added the bug Something isn't working label Mar 9, 2022
@rs-amp rs-amp changed the title fix(content-item): avoid archiving content if content-item import is cancelled by user fix(content-item): rework move to avoid archiving skipped content or dependencies Mar 11, 2022
const item = await client.contentItems.get(exported[i]);
const ids = exported.filter(id => imported.has(id));

console.log(exported);
Copy link
Member

Choose a reason for hiding this comment

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

Are these console.log's left in by accident?

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants