Don't add the webxdc twice if the setting is set twice

This commit is contained in:
Hocuri
2022-05-29 17:36:35 +02:00
committed by Septias
parent 55922db33c
commit d14ae03356
2 changed files with 9 additions and 3 deletions

View File

@@ -340,9 +340,15 @@ impl Context {
{
message::delete_msgs(self, &[MsgId::new(webxdc_message_id)]).await?;
}
self.sql.set_raw_config(key, value).await?;
self.sql.set_raw_config(key, None).await?;
self.debug_logging.store(0, atomic::Ordering::Relaxed);
} else {
} else if self
.sql
.get_raw_config_u32(Config::DebugLogging)
.await?
.unwrap_or(0)
== 0
{
// the unbundled version lives at https://github.com/webxdc/webxdc_logging
let data: &[u8] = include_bytes!("../assets/webxdc_logging.xdc");

View File

@@ -1286,7 +1286,7 @@ pub async fn delete_msgs(context: &Context, msg_ids: &[MsgId]) -> Result<()> {
if context.get_config(Config::DebugLogging).await? == Some(msg_id.to_u32().to_string()) {
context
.sql
.set_raw_config(Config::DebugLogging, Some("0"))
.set_raw_config(Config::DebugLogging, None)
.await?;
context.debug_logging.store(0, atomic::Ordering::Relaxed);
}