Skip to main content

replace_reviewer

Function replace_reviewer 

Source
pub async fn replace_reviewer(
    pool: &PgPool,
    actor: &Actor,
    change_id: Uuid,
    old_reviewer_id: Uuid,
    username: &str,
) -> AppResult<()>
Expand description

Replaces a reviewer who has not decided yet while the change is in review (typically one who is absent: deactivated, demoted or blind to an item). The other decisions are kept.

ยงInvariants

  • Permission: CAD editor who is the author (or an administrator) and sees every item (403); the change is in review (409); old is a reviewer with a pending decision (404 / 409); the substitute is an active user with at least the editor role (400), not yet a reviewer (409), conflict-free under the four-eyes rule (400) and sees every item (409).
  • Locks: the change row (FOR UPDATE).
  • Audit: change.replace_reviewer.
  • Notifications: the substitute (review requested); webhooks: none.
  • Atomic: one transaction.