mirror of
https://github.com/chatmail/core.git
synced 2026-05-09 01:46:30 +03:00
simplify check for existing device-message
This commit is contained in:
@@ -1962,12 +1962,7 @@ pub fn add_device_msg(
|
|||||||
|
|
||||||
// if the device message is labeled and was ever added, do nothing
|
// if the device message is labeled and was ever added, do nothing
|
||||||
if let Some(label) = label {
|
if let Some(label) = label {
|
||||||
ensure!(!label.is_empty(), "cannot add empty label");
|
if has_device_msg(context, label)? {
|
||||||
if let Ok(()) = context.sql.query_row(
|
|
||||||
"SELECT label FROM devmsglabels WHERE label=?",
|
|
||||||
params![label],
|
|
||||||
|_| Ok(()),
|
|
||||||
) {
|
|
||||||
info!(context, "device-message {} already added", label);
|
info!(context, "device-message {} already added", label);
|
||||||
return Ok(MsgId::new_unset());
|
return Ok(MsgId::new_unset());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user