Skip to main content

publish

Function publish 

Source
pub async fn publish(
    conn: &mut PgConnection,
    changeset_id: Uuid,
    options: PublishOptions,
    app_conf: &ApplicationConfiguration,
    spec_fetcher: impl SpecFetcher,
    fetch_service_info: impl Fn(Url) -> BoxFuture<'static, ModelResult<ExerciseServiceInfoApi>>,
) -> ModelResult<PublishOutcome>
Expand description

Publishes an open changeset: writes every staged entity in one transaction, through the module and chapter writers, the CMS page save and the course save paths, and marks the changeset published.

Pages are saved with their exercise ids kept. Every history row written is attributed to the changeset’s owner through the latest call that staged the entity. A page whose path changed gets a redirect from its old path.

Risk is classified again against the live course and student activity of this moment, and the new reasons are stored. Returns PublishOutcome::Rejected, writing nothing, for any PublishRejection reason.