alleyinteractive / alley-scripts

A collection of scripts and utilities for Alley projects.
https://alley-scripts.alley.dev/
6 stars 1 forks source link

Include Scheduled Posts in Post Picker #601

Closed bmcnulty7 closed 8 months ago

bmcnulty7 commented 8 months ago

Description

Include scheduled posts in the post picker modal so editors can pick scheduled posts in various locations the post picker is used. A backfilled post should populate the post picker spot until the scheduled post goes live, then the scheduled post should appear in the selected location.

Use Case

A user should be able to select a scheduled post from the post picker so that they don't need to wait until the post goes live to put it in the location they want it.

mogmarsh commented 8 months ago

I think this work is going to need to be done in the application using Post Picker and not in Post Picker itself. Post Picker supports passing additional parameters to the REST endpoint, but some server side filters will need to be added to return scheduled posts, and then the logic to backfill with a published post on the front end until the post is published will definitely be up to the parent application.

anubisthejackle commented 8 months ago

@mogmarsh Is there a technical hurdle that we'd need to leap for this? I know that the Post List component uses the Search API, and it doesn't seem that the Search API allows us to modify the statuses that are shown. If thats the only issue, then maybe we could modify it to use the Posts API instead?

anubisthejackle commented 8 months ago

It does seem like we could do this server-side by filtering rest_post_search_query and setting $query_args['post_status'] = 'publish,future'

mogmarsh commented 8 months ago

No changes need to be made to Post Picker. This will all need to be handled in the component calling Post Picker and also some server side filters.