Skip to content

Conversation

@shchypylov
Copy link

Pull request type

Jira Link: N/A

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Other (please describe):

How to test this PR

You need to rollback a migration and observe that content after is being published (previously, rollback content was in "Draft" state).

What is the new behavior?

  • new publish flag for rollback-migration was added
  • user now has an option to publish his content after running the rollback command

Other information

Based on this issue

Comment on lines 9 to 32
/**
* @method isStoryPublishedWithoutChanges
* @param {Object} story
* @return {Boolean}
*/
const isStoryPublishedWithoutChanges = story => {
return story.published && !story.unpublished_changes
}

/**
* @method isStoryWithUnpublishedChanges
* @param {Object} story
* @return {Boolean}
*/
const isStoryWithUnpublishedChanges = story => {
return story.published && story.unpublished_changes
}
/**
* @typedef {'all'|'published'|'published-with-changes'} PublishOptions
*
* @typedef {Object} RunRollbackOptions
* @property {PublishOptions} publish
* /
Copy link
Member

Choose a reason for hiding this comment

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

These functions already exist in the run.js file, how about extracting them from there to a constants file and using them in both places?

Copy link
Author

Choose a reason for hiding this comment

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

Done, moved them to utils.js file and reused them in run.js and rollback.js files.

Copy link
Member

@ademarCardoso ademarCardoso left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution 💪🏼

Please take a look in my comments 😄

@shchypylov
Copy link
Author

shchypylov commented Sep 2, 2023

@ademarCardoso, hey, sorry for the delay! I have updated the code base, please, take a look.

@shchypylov
Copy link
Author

@ademarCardoso, hi there! Did you have a chance to check the changes I made?

@shchypylov
Copy link
Author

@ademarCardoso, ping 🙃

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.

2 participants