httpd: Add `patch::Action::Lifecycle`
Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
This commit is contained in:
parent
c9aaaec2ee
commit
8907ddb8a5
|
|
@ -645,6 +645,9 @@ async fn patch_update_handler(
|
|||
patch::Action::Redact { .. } => {
|
||||
todo!()
|
||||
}
|
||||
patch::Action::Lifecycle { state } => {
|
||||
patch.lifecycle(state, &signer)?;
|
||||
}
|
||||
patch::Action::Review {
|
||||
revision,
|
||||
comment,
|
||||
|
|
|
|||
|
|
@ -93,6 +93,9 @@ pub enum Action {
|
|||
base: git::Oid,
|
||||
oid: git::Oid,
|
||||
},
|
||||
Lifecycle {
|
||||
state: State,
|
||||
},
|
||||
Redact {
|
||||
revision: RevisionId,
|
||||
},
|
||||
|
|
@ -269,6 +272,9 @@ impl store::FromHistory for Patch {
|
|||
self.description.set(description, op.clock);
|
||||
self.target.set(target, op.clock);
|
||||
}
|
||||
Action::Lifecycle { state } => {
|
||||
self.state.set(state, op.clock);
|
||||
}
|
||||
Action::Tag { add, remove } => {
|
||||
for tag in add {
|
||||
self.tags.insert(tag, op.clock);
|
||||
|
|
@ -697,6 +703,11 @@ impl store::Transaction<Patch> {
|
|||
})
|
||||
}
|
||||
|
||||
/// Lifecycle a patch.
|
||||
pub fn lifecycle(&mut self, state: State) -> Result<(), store::Error> {
|
||||
self.push(Action::Lifecycle { state })
|
||||
}
|
||||
|
||||
/// Tag a patch.
|
||||
pub fn tag(
|
||||
&mut self,
|
||||
|
|
@ -839,6 +850,11 @@ impl<'a, 'g> PatchMut<'a, 'g> {
|
|||
})
|
||||
}
|
||||
|
||||
/// Lifecycle a patch.
|
||||
pub fn lifecycle<G: Signer>(&mut self, state: State, signer: &G) -> Result<EntryId, Error> {
|
||||
self.transaction("Lifecycle", signer, |tx| tx.lifecycle(state))
|
||||
}
|
||||
|
||||
/// Tag a patch.
|
||||
pub fn tag<G: Signer>(
|
||||
&mut self,
|
||||
|
|
|
|||
Loading…
Reference in New Issue