make config prefix removal undoable
This commit is contained in:
parent
610f0b5254
commit
57eab0e33d
@ -19,7 +19,7 @@ impl DeckConfigKey {
|
||||
}
|
||||
|
||||
impl Collection {
|
||||
pub(crate) fn clear_aux_config_for_deck(&self, ntid: DeckId) -> Result<()> {
|
||||
pub(crate) fn clear_aux_config_for_deck(&mut self, ntid: DeckId) -> Result<()> {
|
||||
self.remove_config_prefix(&build_aux_deck_key(ntid, ""))
|
||||
}
|
||||
|
||||
|
@ -117,9 +117,9 @@ impl Collection {
|
||||
}
|
||||
|
||||
/// Remove all keys starting with provided prefix, which must end with '_'.
|
||||
pub(crate) fn remove_config_prefix(&self, key: &str) -> Result<()> {
|
||||
pub(crate) fn remove_config_prefix(&mut self, key: &str) -> Result<()> {
|
||||
for (key, _val) in self.storage.get_config_prefix(key)? {
|
||||
self.storage.remove_config(&key)?;
|
||||
self.remove_config(key.as_str())?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ impl Collection {
|
||||
.map(|_| ())
|
||||
}
|
||||
|
||||
pub(crate) fn clear_aux_config_for_notetype(&self, ntid: NotetypeId) -> Result<()> {
|
||||
pub(crate) fn clear_aux_config_for_notetype(&mut self, ntid: NotetypeId) -> Result<()> {
|
||||
self.remove_config_prefix(&build_aux_notetype_key(ntid, ""))
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user