app/workers/publishing_api_withdrawal_worker.rb
def perform(content_id, explanation, locale, allow_draft = false, unpublished_at = nil)
    check_if_locked_document(content_id: content_id)

    Services.publishing_api.unpublish(
      content_id,
      type: "withdrawal",
      locale: locale,
      explanation: Whitehall::GovspeakRenderer.new.govspeak_to_html(explanation),
      allow_draft: allow_draft,
      unpublished_at: find_unpublished_at(content_id, unpublished_at),
    )
  rescue GdsApi::HTTPNotFound, GdsApi::HTTPUnprocessableEntity
    # nothing to do here as we can't unpublish something that doesn't exist
    nil
  end
# `explanation` and `unpublished_at` come from the unpublishing object. Rather than
# performing a database query here to look up the `unpublishing` linked to the most
# recent edition, we pass it in directly because the `unpublishing` isn't always
# saved in the database yet when this worker runs.
`explanation` and `unpublished_at` come from the unpublishing object. Rather than
performing a database query here to look up the `unpublishing` linked to the most
recent edition, we pass it in directly because the `unpublishing` isn't always
saved in the database yet when this worker runs.
` explanation ` and ` unpublished_at ` come from the unpublishing object . Rather than performing a database query here to look up the ` unpublishing ` linked to the most recent edition we pass it in directly because the ` unpublishing ` isn ' t always saved in the database yet when this worker runs .
def perform(content_id, explanation, locale, allow_draft = false, unpublished_at = nil)
    check_if_locked_document(content_id: content_id)
    Services.publishing_api.unpublish(
      content_id,
      type: "withdrawal",
      locale: locale,
      explanation: Whitehall::GovspeakRenderer.new.govspeak_to_html(explanation),
      allow_draft: allow_draft,
      unpublished_at: find_unpublished_at(content_id, unpublished_at),
    )
  rescue GdsApi::HTTPNotFound, GdsApi::HTTPUnprocessableEntity
    nil
  end
def perform ( content_id , explanation , locale , allow_draft = false , unpublished_at = nil ) check_if_locked_document ( content_id : content_id ) Services . publishing_api . unpublish ( content_id , type : "withdrawal" , locale : locale , explanation : Whitehall :: GovspeakRenderer . new . govspeak_to_html ( explanation ) , allow_draft : allow_draft , unpublished_at : find_unpublished_at ( content_id , unpublished_at ) , ) rescue GdsApi :: HTTPNotFound , GdsApi :: HTTPUnprocessableEntity nil end
`explanation` and `unpublished_at` come from the unpublishing object.
` explanation ` and ` unpublished_at ` come from the unpublishing object .
# nothing to do here as we can't unpublish something that doesn't exist
content_id
explanation
locale
allow_draft
unpublished_at