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

Strapi: Allow scheduling content to be published / unpublished #2008

Merged
merged 6 commits into from
Oct 2, 2023

Conversation

jarstelfox
Copy link
Contributor

@jarstelfox jarstelfox commented Oct 2, 2023

I decided to go with https://github.com/ComfortablyCoding/strapi-plugin-publisher as it is slightly more robust: More devs, longer lived, more releases, newer releases, more downloads etc

QA

  • I had to run the following to kick over strapi locally
    • cd backend/ && rm -rf .cache/ node_modules/ dist/
    • Then cd ../ && pnpm install:all
  • After running pnpm dev strapi should allow scheduling
  • Note: The scheduling UI does not appear until after the first save of an item

Before:
image

Click save once, then you should see:
image

Closes: https://github.com/iFixit/ifixit/issues/50009

See install instrictions here: https://market.strapi.io/plugins/strapi-plugin-publisher

>The cron.enabled configuration option needs to be set to true in Server Configuration for the plugin to work.

The plugin registers its own cron here: https://github.com/ComfortablyCoding/strapi-plugin-publisher/blob/0c84bb97a29cfe3da3be1321714d17b96e3ebed2/server/config/cron-tasks.js#L10-L11

Note: We are leveraging the default cron for now which is https://github.com/ComfortablyCoding/strapi-plugin-publisher/blob/0c84bb97a29cfe3da3be1321714d17b96e3ebed2/server/config/index.js#L8
Something was slightly off and complained.

I removed the node modules dir and reinstalled.
Everything is workign great now.
The time picker is a select with an option for each valid time

If we use the default of 1 we end up with 24 hours * 60 mins = 1440 options!

Let's limit it to 96 options (4 times an hour * 24 hours)
@vercel
Copy link

vercel bot commented Oct 2, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-commerce ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 2, 2023 9:20pm
react-commerce-prod ✅ Ready (Inspect) Visit Preview Oct 2, 2023 9:20pm

@github-actions
Copy link
Contributor

github-actions bot commented Oct 2, 2023

📦 Next.js Bundle Analysis for @ifixit/commerce-frontend

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

Copy link
Contributor

@masonmcelvain masonmcelvain left a comment

Choose a reason for hiding this comment

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

CR 👏🏻 Nice work, glad it was simple! From a quick search I didn't see any other publishing plugins besides this one and the one mentioned in the issue, and I agree that this one looks better

@jarstelfox
Copy link
Contributor Author

QA 🌵

I visited https://strapi-ability-to-schedule-posts.govinor.com/admin/content-manager/collectionType/api::product-list.product-list/2?plugins[i18n][locale]=en

Then saved a new item and it magically changed:

image

Note: You can add an item to be scheduled in the past (1 min ago) and the next cron tick will publish it.

@davidrans davidrans merged commit a86744d into main Oct 2, 2023
14 checks passed
@davidrans davidrans deleted the strapi-ability-to-schedule-posts branch October 2, 2023 22:49
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.

None yet

3 participants