[TAN-7137] Add scheduled publication status transitions#13608
Open
[TAN-7137] Add scheduled publication status transitions#13608
Conversation
927443e to
1bbbf45
Compare
Collaborator
|
1bbbf45 to
fd8ecda
Compare
…cation Add columns, validations, and effective status computation for scheduling future publication status transitions. Scopes and predicates reflect the effective status immediately when the scheduled time passes.
…d folder policies
Background job that materializes scheduled publication status transitions.
When a schedule is set via project or folder update, the `SideFx` service enqueues `ProcessScheduledPublicationTransitionJob` with `wait_until: scheduled_at`.
…ct publication_status column references Many places queried admin_publications.publication_status directly in SQL joins and where clauses. These bypass the effective status computation and wouldn't account for scheduled transitions whose time has passed.
… definitions
Store the scheduling user in a new `scheduled_by_id` column on admin_publications instead of passing it as a job argument. This lets us materialize the status transition from other places too, such as a sweep job that recovers failed scheduled transitions, or a controller that needs to handle edge cases when the publication status is changed after `scheduled_at` has passed but before the materialization job has run.
When an admin modifies or deletes a project after scheduled_at has passed but before the job ran, the SideFx service now runs the transition synchronously first. This ensures side effects like activity logs, emails, and first_published_at are recorded before the admin's operation proceeds.
…jects Projects that were scheduled to publish and whose publish date has already passed are now protected from moderator deletion, even if the materialization job hasn't run yet.
…llers The ProcessScheduledPublicationTransitionsJob (plural) now sweeps through all due transitions by default, but you can also target a specific one by passing an admin_publication. Moved synchronous materialization out of SideFx services and into controllers, right before assign_attributes. This sidesteps conflicts from unpersisted changes and avoids infinite recursion. Also added the job to hourly_jobs.rake as a safety net.
fd8ecda to
4c6cbbe
Compare
Only expose `scheduled_status` and `scheduled_at` attributes to moderators and admins.
f63bd3a to
388cdeb
Compare
# Conflicts: # back/app/services/side_fx_project_service.rb # back/db/structure.sql
Moving the logic that auto-sets `scheduled_by` since it felt a bit hidden in the side fx service, plus refactoring parameter extraction in the controllers.
When filter_by is not provided, nil.in? returns false, so no scope is built. The ordering method then crashes with PG::UndefinedColumn because it references a column from a JOIN that was never applied.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog
For translators
TODOs
ProcessScheduledPublicationTransitionsJob