mirror of
https://github.com/chatmail/core.git
synced 2026-05-04 13:56:30 +03:00
Implement set/get_ui_config and use those methods if config string starts with 'ui.'
This commit is contained in:
@@ -129,6 +129,23 @@ impl Context {
|
||||
_ => self.sql.set_config(self, key, value),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_ui_config(&self, key: &str, value: Option<&str>) -> Result<(), &str> {
|
||||
if !key.starts_with("ui.") {
|
||||
return Err("Ui config key has to be prefixed with 'ui.'")
|
||||
}
|
||||
|
||||
if self.sql.set_config(self, key, value).is_err() {
|
||||
return Err("Sql error")
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
pub fn get_ui_config(&self, key: &str) -> Option<String> {
|
||||
if key.starts_with("ui.") {
|
||||
return self.sql.get_config(self, key);
|
||||
}
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns all available configuration keys concated together.
|
||||
|
||||
Reference in New Issue
Block a user