pub async fn add_action(
pool: &PgPool,
actor: &Actor,
change_id: Uuid,
revision_id: Uuid,
action: LineAction,
successor_number: Option<&str>,
) -> AppResult<()>Expand description
Adds an action line to a draft change: the released revision is obsoleted
(obsolete) or obsoleted and its item declared superseded by successor_number
(supersede) when the change is released. Allowed in every group; groups with
obsolete_requires_change demand it.
§Invariants
- Permission: CAD editor who is the author (or an administrator); the change is a draft (409); the revision is visible (“not found” otherwise) and in a group the actor may edit (403), released (409) and in no other open change (409); every reviewer of the change can see it (409 each). A supersede line needs a visible successor item that is not the item itself (400) and does not close a circle (409); an obsolete line takes no successor (400).
- Locks: the change row (
FOR UPDATE), the revision row, the tableitem_supersessionsfor a supersede line. - Audit:
change.add_itemwith the action, only when the line is new or changed. - Notifications / webhooks: none.
- Atomic: one transaction.