mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
slightly simplify transact_inner()
This commit is contained in:
parent
af50c445dd
commit
e3db8641d1
1 changed files with 5 additions and 11 deletions
|
@ -14,21 +14,15 @@ impl Collection {
|
||||||
self.begin_undoable_operation(op);
|
self.begin_undoable_operation(op);
|
||||||
|
|
||||||
func(self)
|
func(self)
|
||||||
// any changes mean an mtime bump
|
.and_then(|output| {
|
||||||
.and_then(|out| {
|
// any changes mean an mtime bump
|
||||||
if !have_op || (self.current_undo_step_has_changes() && !self.undoing_or_redoing())
|
if !have_op || (self.current_undo_step_has_changes() && !self.undoing_or_redoing())
|
||||||
{
|
{
|
||||||
self.set_modified()?;
|
self.set_modified()?;
|
||||||
}
|
}
|
||||||
Ok(out)
|
// then commit
|
||||||
})
|
|
||||||
// then commit
|
|
||||||
.and_then(|out| {
|
|
||||||
self.storage.commit_rust_trx()?;
|
self.storage.commit_rust_trx()?;
|
||||||
Ok(out)
|
// finalize undo
|
||||||
})
|
|
||||||
// finalize undo step
|
|
||||||
.map(|output| {
|
|
||||||
let changes = if have_op {
|
let changes = if have_op {
|
||||||
let changes = self.op_changes();
|
let changes = self.op_changes();
|
||||||
self.maybe_clear_study_queues_after_op(&changes);
|
self.maybe_clear_study_queues_after_op(&changes);
|
||||||
|
@ -43,7 +37,7 @@ impl Collection {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
self.end_undoable_operation();
|
self.end_undoable_operation();
|
||||||
OpOutput { output, changes }
|
Ok(OpOutput { output, changes })
|
||||||
})
|
})
|
||||||
// roll back on error
|
// roll back on error
|
||||||
.or_else(|err| {
|
.or_else(|err| {
|
||||||
|
|
Loading…
Reference in a new issue