Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(v2): add draft feature to blog posts #2335

Merged
merged 1 commit into from
Feb 29, 2020

Conversation

lex111
Copy link
Contributor

@lex111 lex111 commented Feb 27, 2020

Motivation

Resolve #2314

Have you read the Contributing Guidelines on pull requests?

Yes

Test Plan

  1. Create a new blog post with approximately the same contents:
---
title: Draft post
draft: true
---

This post is in WIP state and should not be published!
  1. Run local development server and make sure the new blog post is displayed.

  2. Build website and make sure the new blog post is not in the posts list.

Related PRs

(If this PR adds or changes functionality, please take some time to update the docs at https://github.com/facebook/docusaurus, and link to your PR here.)

@lex111 lex111 added the pr: new feature This PR adds a new API or behavior. label Feb 27, 2020
@lex111 lex111 requested a review from yangshun February 27, 2020 10:03
@lex111 lex111 requested a review from wgao19 as a code owner February 27, 2020 10:03
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Feb 27, 2020
@docusaurus-bot
Copy link
Contributor

docusaurus-bot commented Feb 27, 2020

Deploy preview for docusaurus-2 ready!

Built with commit 1580e60

https://deploy-preview-2335--docusaurus-2.netlify.com

@lex111 lex111 force-pushed the lex111/feat-draft-blog-posts branch 8 times, most recently from 0cf1e5f to ffe505b Compare February 27, 2020 11:29
@lex111 lex111 force-pushed the lex111/feat-draft-blog-posts branch from ffe505b to 1580e60 Compare February 27, 2020 11:35
Comment on lines +88 to +89
...blogPosts.find(v => v.metadata.title === 'no date').metadata,
...{prevItem: undefined},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was necessary to modify the existing tests here and below, so that the tests pass successfully in the CI.

The fact is that in fixtures there is a no date file, it does not have a date, which means that it is calculated from the creation date. But the “oddity” of CI is that it copies, as I suppose this file, and therefore its creation date will always be equal to the current test execution time, which is why expected and received data no longer match!

As I wrote above, this issue applies only to CI, locally tests pass successfully without these changes. But in order to achieve successful execution of tests in CI, we need to exclude the prevItem key from the metadata object since this element will change in the CI environment (CIrcieCI).

I don’t know how clearly I have stated the essence of the problem, but in this case I consider such a solution acceptable, because we ran into details of handling this CI.

Copy link
Contributor

@yangshun yangshun left a comment

Choose a reason for hiding this comment

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

This is awesome, thanks!

@yangshun yangshun merged commit 84eeb51 into master Feb 29, 2020
@yangshun yangshun deleted the lex111/feat-draft-blog-posts branch February 29, 2020 05:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: new feature This PR adds a new API or behavior.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[V2] Adding "Draft" header option for Blog
4 participants