mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 17:36:29 +03:00
Set ephemeral timer for info messages
This commit is contained in:
committed by
link2xt
parent
d59475f9bb
commit
5a28b669f9
10
src/chat.rs
10
src/chat.rs
@@ -2777,9 +2777,16 @@ pub(crate) async fn delete_and_reset_all_device_msgs(context: &Context) -> Resul
|
|||||||
/// For example, it can be a message showing that a member was added to a group.
|
/// For example, it can be a message showing that a member was added to a group.
|
||||||
pub(crate) async fn add_info_msg(context: &Context, chat_id: ChatId, text: impl AsRef<str>) {
|
pub(crate) async fn add_info_msg(context: &Context, chat_id: ChatId, text: impl AsRef<str>) {
|
||||||
let rfc724_mid = dc_create_outgoing_rfc724_mid(None, "@device");
|
let rfc724_mid = dc_create_outgoing_rfc724_mid(None, "@device");
|
||||||
|
let ephemeral_timer = match chat_id.get_ephemeral_timer(context).await {
|
||||||
|
Err(e) => {
|
||||||
|
warn!(context, "Could not get timer for info msg: {}", e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Ok(ephemeral_timer) => ephemeral_timer,
|
||||||
|
};
|
||||||
|
|
||||||
if let Err(e) = context.sql.execute(
|
if let Err(e) = context.sql.execute(
|
||||||
"INSERT INTO msgs (chat_id,from_id,to_id, timestamp,type,state, txt,rfc724_mid) VALUES (?,?,?, ?,?,?, ?,?);",
|
"INSERT INTO msgs (chat_id,from_id,to_id, timestamp,type,state, txt,rfc724_mid,ephemeral_timer) VALUES (?,?,?, ?,?,?, ?,?,?);",
|
||||||
paramsv![
|
paramsv![
|
||||||
chat_id,
|
chat_id,
|
||||||
DC_CONTACT_ID_INFO,
|
DC_CONTACT_ID_INFO,
|
||||||
@@ -2789,6 +2796,7 @@ pub(crate) async fn add_info_msg(context: &Context, chat_id: ChatId, text: impl
|
|||||||
MessageState::InNoticed,
|
MessageState::InNoticed,
|
||||||
text.as_ref().to_string(),
|
text.as_ref().to_string(),
|
||||||
rfc724_mid,
|
rfc724_mid,
|
||||||
|
ephemeral_timer
|
||||||
]
|
]
|
||||||
).await {
|
).await {
|
||||||
warn!(context, "Could not add info msg: {}", e);
|
warn!(context, "Could not add info msg: {}", e);
|
||||||
|
|||||||
Reference in New Issue
Block a user