-
-
Notifications
You must be signed in to change notification settings - Fork 7k
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
Add scheduled statuses #9706
Add scheduled statuses #9706
Conversation
7b58fa4
to
a2b485e
Compare
Apologies for this not being a code review, but this is another way to set Mastodon apart from that other service with the birds. |
a2b485e
to
fd24db2
Compare
Will there be a limit on the number of prescheduled posts? Same question (if different answer) for media posts. Also, is there a limit for how far in the future you can schedule? |
My suggestion was to limit scheduled posts to five, if only to match the minimum amount of time one could schedule. Five posts. Five minutes. |
Is there a way to list scheduled statuses and delete one? |
This is essential for curators. Thanks for doing this work. CRUD would be really helpful, yes. |
d7173c4
to
2c2856d
Compare
2c2856d
to
5e99345
Compare
@Gargron Any change this will result in a UI for the web-app somewhere in the (near) future? |
please add check scheduled_at is after 5min or later, because the wall clock of client machine may not correct, and customized instance may have different limit. |
Thank you @Gargron for making this great feature happen! ❤️
I would love to see this feature exposed in the web UI too 🙏 |
Is there already a issue/feature request for the web UI to create and manage scheduled toot's I could follow? |
As I couldn't find a follow-up issue I created now one #10088 |
Allows users to schedule a toot (with media attachments) to be published at a certain future date. This PR only includes REST API changes, no UI.
The scheduled date must be at least 5 minutes into the future. At most, 300 toots can be scheduled at the same time. Only 50 toots can be scheduled for any given day.
Fix #340
API changes
POST /api/v1/statuses
new paramscheduled_at
(timestamp string). When present, and more than 5 minutes into the future, the API method will return a Scheduled Status instead of Status. The Scheduled Status will be turned into a real Status roughly at the scheduled time.GET /api/v1/scheduled_statuses
GET|PUT|DELETE /api/v1/scheduled_statuses/:id
Refactoring
The PR includes a refactor of the PostStatusService class to allow passing all necessary options from a single hash, which allows encoding it more easily in the scheduled_statuses table.
Overview
The high-level overview of the PR: When scheduled_at option is present, instead of creating a status, we only run status validation, and if it passes, we create an entry in scheduled_statuses which encodes the status attributes. Media attachments now also track scheduled_status_id to prevent clearing out the ones that are going to be attached later. Every 5 minutes, a scheduler iterates over the scheduled_statuses table to fetch the ones due in the next 5 minutes, and push them into a more precise Sidekiq queue. In Sidekiq, the individual statuses are created, with media attachments being unassigned from the scheduled status and assigned to the real one.