mirror of
https://github.com/chatmail/core.git
synced 2026-05-14 20:36:30 +03:00
Delete message only if its a POI
This commit is contained in:
@@ -843,7 +843,7 @@ pub fn delete_msgs(context: &Context, msg_ids: &[MsgId]) {
|
|||||||
for msg_id in msg_ids.iter() {
|
for msg_id in msg_ids.iter() {
|
||||||
if let Ok(msg) = Message::load_from_db(context, *msg_id) {
|
if let Ok(msg) = Message::load_from_db(context, *msg_id) {
|
||||||
if msg.location_id > 0 {
|
if msg.location_id > 0 {
|
||||||
update_location_chat_id(context, msg.location_id, DC_CHAT_ID_TRASH);
|
delete_poi_location(context, msg.location_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
update_msg_chat_id(context, *msg_id, DC_CHAT_ID_TRASH);
|
update_msg_chat_id(context, *msg_id, DC_CHAT_ID_TRASH);
|
||||||
@@ -876,12 +876,12 @@ fn update_msg_chat_id(context: &Context, msg_id: MsgId, chat_id: u32) -> bool {
|
|||||||
.is_ok()
|
.is_ok()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update_location_chat_id(context: &Context, location_id: u32, chat_id: u32) -> bool {
|
fn delete_poi_location(context: &Context, location_id: u32) -> bool {
|
||||||
sql::execute(
|
sql::execute(
|
||||||
context,
|
context,
|
||||||
&context.sql,
|
&context.sql,
|
||||||
"UPDATE locations SET chat_id=? WHERE id=?;",
|
"DELETE FROM locations WHERE independent = 1 AND id=?;",
|
||||||
params![chat_id as i32, location_id as i32],
|
params![location_id as i32],
|
||||||
)
|
)
|
||||||
.is_ok()
|
.is_ok()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user