mirror of
https://github.com/ankitects/anki.git
synced 2025-11-13 08:07:11 -05:00
make config prefix removal undoable
This commit is contained in:
parent
610f0b5254
commit
57eab0e33d
3 changed files with 4 additions and 4 deletions
|
|
@ -19,7 +19,7 @@ impl DeckConfigKey {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Collection {
|
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, ""))
|
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 '_'.
|
/// 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)? {
|
for (key, _val) in self.storage.get_config_prefix(key)? {
|
||||||
self.storage.remove_config(&key)?;
|
self.remove_config(key.as_str())?;
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ impl Collection {
|
||||||
.map(|_| ())
|
.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, ""))
|
self.remove_config_prefix(&build_aux_notetype_key(ntid, ""))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue