cob: Don't lose state when lifecycling
It was previously possible to switch a merged patch to "open", losing the merge state.
This commit is contained in:
parent
5b1cdbaa4a
commit
538ca1e44d
|
|
@ -706,17 +706,25 @@ impl Patch {
|
|||
self.title = title;
|
||||
self.target = target;
|
||||
}
|
||||
Action::Lifecycle { state } => match state {
|
||||
Lifecycle::Open => {
|
||||
self.state = State::Open { conflicts: vec![] };
|
||||
Action::Lifecycle { state } => {
|
||||
let valid = self.state == State::Draft
|
||||
|| self.state == State::Archived
|
||||
|| self.state == State::Open { conflicts: vec![] };
|
||||
|
||||
if valid {
|
||||
match state {
|
||||
Lifecycle::Open => {
|
||||
self.state = State::Open { conflicts: vec![] };
|
||||
}
|
||||
Lifecycle::Draft => {
|
||||
self.state = State::Draft;
|
||||
}
|
||||
Lifecycle::Archived => {
|
||||
self.state = State::Archived;
|
||||
}
|
||||
}
|
||||
}
|
||||
Lifecycle::Draft => {
|
||||
self.state = State::Draft;
|
||||
}
|
||||
Lifecycle::Archived => {
|
||||
self.state = State::Archived;
|
||||
}
|
||||
},
|
||||
}
|
||||
Action::Label { labels } => {
|
||||
self.labels = BTreeSet::from_iter(labels);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue