huskies: merge 984
This commit is contained in:
@@ -111,6 +111,30 @@ pub fn set_resume_to(story_id: &str, stage: &Stage) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
/// Set the `resume_to` CRDT register to an arbitrary raw string.
|
||||
///
|
||||
/// Story 984: reuses `resume_to` to carry metadata for `Superseded`
|
||||
/// (`superseded_by` story ID) and `Rejected` (`reason` string). These
|
||||
/// stages never have a resume target, so the register is exclusively
|
||||
/// available for their metadata.
|
||||
///
|
||||
/// Returns `true` if the item was found and the op was applied.
|
||||
pub fn set_resume_to_raw(story_id: &str, value: &str) -> bool {
|
||||
let Some(state_mutex) = get_crdt() else {
|
||||
return false;
|
||||
};
|
||||
let Ok(mut state) = state_mutex.lock() else {
|
||||
return false;
|
||||
};
|
||||
let Some(&idx) = state.index.get(story_id) else {
|
||||
return false;
|
||||
};
|
||||
apply_and_persist(&mut state, |s| {
|
||||
s.crdt.doc.items[idx].resume_to.set(value.to_string())
|
||||
});
|
||||
true
|
||||
}
|
||||
|
||||
/// Set the `name` field for a pipeline item by its story ID.
|
||||
///
|
||||
/// `Some(name)` writes the human-readable name into the CRDT register.
|
||||
|
||||
Reference in New Issue
Block a user