mirror of
https://github.com/chatmail/core.git
synced 2026-05-05 22:36:30 +03:00
Merge pull request #844 from deltachat/move-location-to-trash
Delete msg related POI when message is deleted
This commit is contained in:
@@ -841,6 +841,11 @@ pub fn get_mime_headers(context: &Context, msg_id: MsgId) -> Option<String> {
|
|||||||
|
|
||||||
pub fn delete_msgs(context: &Context, msg_ids: &[MsgId]) {
|
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 msg.location_id > 0 {
|
||||||
|
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);
|
||||||
job_add(
|
job_add(
|
||||||
context,
|
context,
|
||||||
@@ -871,6 +876,16 @@ fn update_msg_chat_id(context: &Context, msg_id: MsgId, chat_id: u32) -> bool {
|
|||||||
.is_ok()
|
.is_ok()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn delete_poi_location(context: &Context, location_id: u32) -> bool {
|
||||||
|
sql::execute(
|
||||||
|
context,
|
||||||
|
&context.sql,
|
||||||
|
"DELETE FROM locations WHERE independent = 1 AND id=?;",
|
||||||
|
params![location_id as i32],
|
||||||
|
)
|
||||||
|
.is_ok()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn markseen_msgs(context: &Context, msg_ids: &[MsgId]) -> bool {
|
pub fn markseen_msgs(context: &Context, msg_ids: &[MsgId]) -> bool {
|
||||||
if msg_ids.is_empty() {
|
if msg_ids.is_empty() {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user