forem icon indicating copy to clipboard operation
forem copied to clipboard

Nullify published_at when unpublishing an article

Open lightalloy opened this issue 3 years ago • 1 comments

What type of PR is this? (check all applicable)

  • [x] Refactor
  • [x] Feature

Description

Nullify published_at when unpublishing an article to avoid situations when we have a draft with published_at displayed in the "Post options" which can be misleading, especially if published_at is already in the past by the time of editing.

Editing an unpublished draft (that was scheduled before) before the changes: изображение

Keeping published_at for unpublished drafts doesn't make a lot of sense, but also doesn't make a lot of harm. There can be potential problems with re-publishing when a draft has published_at in the past, but we have the logic to avoid such problems (we update published_at to current in such cases)

Concerns

I haven't added nullifying published_at for the articles created in the editor v1, which is questionable. The reason is that I wanted to avoid manipulating frontmatter when the user edits it manually, and expects it to look as they left it.

Related Tickets & Documents

  • Related Issue #15858

QA Instructions, Screenshots, Recordings

  • enable the feature flag FeatureFlag.enable(:schedule_articles)
  • create a scheduled article
  • unpublish a scheduled article (edit => post options => convert to a draft)
  • go to edit => post options
  • there should be no published_at set in "schedule publication"

Added/updated tests?

  • [x] Yes

[Forem core team only] How will this change be communicated?

Will this PR introduce a change that impacts Forem members or creators, the development process, or any of our internal teams? If so, please note how you will share this change with the people who need to know about it.

  • [ ] I've updated the Developer Docs or Storybook (for Crayons components)
  • [ ] This PR changes the Forem platform and our documentation needs to be updated. I have filled out the Changes Requested issue template so Community Success can help update the Admin Docs appropriately.
  • [ ] I've updated the README or added inline documentation
  • [ ] I've added an entry to CHANGELOG.md
  • [ ] I will share this change in a Changelog or in a forem.dev post
  • [x] I will share this change internally with the appropriate teams
  • [ ] I'm not sure how best to communicate this change and need help
  • [ ] This change does not need to be communicated, and this is why not: please replace this line with details on why this change doesn't need to be shared

lightalloy avatar Aug 09 '22 07:08 lightalloy

Thank you for opening this PR! We appreciate you!

For all pull requests coming from third-party forks we will need to review the PR before we can process it through our CI pipelines.

A Forem Team member will review this contribution and get back to you as soon as possible!

github-actions[bot] avatar Aug 09 '22 07:08 github-actions[bot]

@jaw6 I saw the top-level comment last, so answered with too much repetition, sorry :D

lightalloy avatar Aug 15 '22 12:08 lightalloy