mirror of
https://github.com/chatmail/core.git
synced 2026-05-13 11:56:30 +03:00
refactor: move delete_poi_location to location module and document it
This commit is contained in:
@@ -486,6 +486,21 @@ pub(crate) async fn delete_expired(context: &Context, now: i64) -> Result<()> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Deletes location if it is an independent location.
|
||||||
|
///
|
||||||
|
/// This function is used when a message is deleted
|
||||||
|
/// that has a corresponding `location_id`.
|
||||||
|
pub(crate) async fn delete_poi_location(context: &Context, location_id: u32) -> Result<()> {
|
||||||
|
context
|
||||||
|
.sql
|
||||||
|
.execute(
|
||||||
|
"DELETE FROM locations WHERE independent = 1 AND id=?",
|
||||||
|
(location_id as i32,),
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns `location.kml` contents.
|
/// Returns `location.kml` contents.
|
||||||
pub async fn get_kml(context: &Context, chat_id: ChatId) -> Result<Option<(String, u32)>> {
|
pub async fn get_kml(context: &Context, chat_id: ChatId) -> Result<Option<(String, u32)>> {
|
||||||
let mut last_added_location_id = 0;
|
let mut last_added_location_id = 0;
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ use crate::download::DownloadState;
|
|||||||
use crate::ephemeral::{start_ephemeral_timers_msgids, Timer as EphemeralTimer};
|
use crate::ephemeral::{start_ephemeral_timers_msgids, Timer as EphemeralTimer};
|
||||||
use crate::events::EventType;
|
use crate::events::EventType;
|
||||||
use crate::imap::markseen_on_imap_table;
|
use crate::imap::markseen_on_imap_table;
|
||||||
|
use crate::location::delete_poi_location;
|
||||||
use crate::mimeparser::{parse_message_id, SystemMessage};
|
use crate::mimeparser::{parse_message_id, SystemMessage};
|
||||||
use crate::param::{Param, Params};
|
use crate::param::{Param, Params};
|
||||||
use crate::pgp::split_armored_data;
|
use crate::pgp::split_armored_data;
|
||||||
@@ -1571,17 +1572,6 @@ pub async fn delete_msgs(context: &Context, msg_ids: &[MsgId]) -> Result<()> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn delete_poi_location(context: &Context, location_id: u32) -> Result<()> {
|
|
||||||
context
|
|
||||||
.sql
|
|
||||||
.execute(
|
|
||||||
"DELETE FROM locations WHERE independent = 1 AND id=?;",
|
|
||||||
(location_id as i32,),
|
|
||||||
)
|
|
||||||
.await?;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Marks requested messages as seen.
|
/// Marks requested messages as seen.
|
||||||
pub async fn markseen_msgs(context: &Context, msg_ids: Vec<MsgId>) -> Result<()> {
|
pub async fn markseen_msgs(context: &Context, msg_ids: Vec<MsgId>) -> Result<()> {
|
||||||
if msg_ids.is_empty() {
|
if msg_ids.is_empty() {
|
||||||
|
|||||||
Reference in New Issue
Block a user