diff --git a/radicle/src/cob/issue.rs b/radicle/src/cob/issue.rs index 226ac992..3d7afb6f 100644 --- a/radicle/src/cob/issue.rs +++ b/radicle/src/cob/issue.rs @@ -112,8 +112,8 @@ impl store::FromHistory for Issue { history: &radicle_cob::History, ) -> Result<(Self, clock::Lamport), store::Error> { let obj = history.traverse(Self::default(), |mut acc, entry| { - if let Ok(Ops(changes)) = Ops::try_from(entry) { - if let Err(err) = acc.apply(changes) { + if let Ok(Ops(ops)) = Ops::try_from(entry) { + if let Err(err) = acc.apply(ops) { log::warn!("Error applying op to issue state: {err}"); return ControlFlow::Break(acc); } @@ -155,29 +155,29 @@ impl Issue { self.thread.comments().map(|(id, comment)| (id, comment)) } - pub fn apply(&mut self, changes: impl IntoIterator) -> Result<(), Error> { - for change in changes { - match change.action { + pub fn apply(&mut self, ops: impl IntoIterator) -> Result<(), Error> { + for op in ops { + match op.action { Action::Title { title } => { - self.title.set(title, change.clock); + self.title.set(title, op.clock); } Action::Lifecycle { status } => { - self.status.set(status, change.clock); + self.status.set(status, op.clock); } Action::Tag { add, remove } => { for tag in add { - self.tags.insert(tag, change.clock); + self.tags.insert(tag, op.clock); } for tag in remove { - self.tags.remove(tag, change.clock); + self.tags.remove(tag, op.clock); } } Action::Thread { action } => { self.thread.apply([cob::Op { action, - author: change.author, - clock: change.clock, - timestamp: change.timestamp, + author: op.author, + clock: op.clock, + timestamp: op.timestamp, }]); } } diff --git a/radicle/src/cob/patch.rs b/radicle/src/cob/patch.rs index 391f9094..cba366b4 100644 --- a/radicle/src/cob/patch.rs +++ b/radicle/src/cob/patch.rs @@ -329,8 +329,8 @@ impl store::FromHistory for Patch { history: &radicle_cob::History, ) -> Result<(Self, clock::Lamport), store::Error> { let obj = history.traverse(Self::default(), |mut acc, entry| { - if let Ok(Ops(changes)) = Ops::try_from(entry) { - if let Err(err) = acc.apply(changes) { + if let Ok(Ops(ops)) = Ops::try_from(entry) { + if let Err(err) = acc.apply(ops) { log::warn!("Error applying op to patch state: {err}"); return ControlFlow::Break(acc); } diff --git a/radicle/src/cob/thread.rs b/radicle/src/cob/thread.rs index 028ac956..ec690a56 100644 --- a/radicle/src/cob/thread.rs +++ b/radicle/src/cob/thread.rs @@ -167,14 +167,13 @@ impl Thread { .map(|(a, r)| (a, r)) } - pub fn apply(&mut self, changes: impl IntoIterator>) { - for change in changes.into_iter() { - let id = change.id(); + pub fn apply(&mut self, ops: impl IntoIterator>) { + for op in ops.into_iter() { + let id = op.id(); - match change.action { + match op.action { Action::Comment { body, reply_to } => { - let present = - Redactable::Present(Comment::new(body, reply_to, change.timestamp)); + let present = Redactable::Present(Comment::new(body, reply_to, op.timestamp)); self.comments.insert(id, present); } Action::Redact { id } => { @@ -185,12 +184,12 @@ impl Thread { reaction, active, } => { - let key = (change.author, reaction); + let key = (op.author, reaction); let reactions = if active { - LWWSet::singleton(key, change.clock) + LWWSet::singleton(key, op.clock) } else { let mut set = LWWSet::default(); - set.remove(key, change.clock); + set.remove(key, op.clock); set }; self.reactions.insert(to, reactions);