mirror of
https://github.com/chatmail/core.git
synced 2026-05-17 05:46:30 +03:00
feat: pre messages can now get read receipts (#7433)
Is it correct that pre messages should send read receipts when seen? @r10s @Hocuri
This commit is contained in:
@@ -1746,7 +1746,6 @@ pub async fn markseen_msgs(context: &Context, msg_ids: Vec<MsgId>) -> Result<()>
|
|||||||
"SELECT
|
"SELECT
|
||||||
m.chat_id AS chat_id,
|
m.chat_id AS chat_id,
|
||||||
m.state AS state,
|
m.state AS state,
|
||||||
m.download_state as download_state,
|
|
||||||
m.ephemeral_timer AS ephemeral_timer,
|
m.ephemeral_timer AS ephemeral_timer,
|
||||||
m.param AS param,
|
m.param AS param,
|
||||||
m.from_id AS from_id,
|
m.from_id AS from_id,
|
||||||
@@ -1759,7 +1758,6 @@ pub async fn markseen_msgs(context: &Context, msg_ids: Vec<MsgId>) -> Result<()>
|
|||||||
|row| {
|
|row| {
|
||||||
let chat_id: ChatId = row.get("chat_id")?;
|
let chat_id: ChatId = row.get("chat_id")?;
|
||||||
let state: MessageState = row.get("state")?;
|
let state: MessageState = row.get("state")?;
|
||||||
let download_state: DownloadState = row.get("download_state")?;
|
|
||||||
let param: Params = row.get::<_, String>("param")?.parse().unwrap_or_default();
|
let param: Params = row.get::<_, String>("param")?.parse().unwrap_or_default();
|
||||||
let from_id: ContactId = row.get("from_id")?;
|
let from_id: ContactId = row.get("from_id")?;
|
||||||
let rfc724_mid: String = row.get("rfc724_mid")?;
|
let rfc724_mid: String = row.get("rfc724_mid")?;
|
||||||
@@ -1771,7 +1769,6 @@ pub async fn markseen_msgs(context: &Context, msg_ids: Vec<MsgId>) -> Result<()>
|
|||||||
id,
|
id,
|
||||||
chat_id,
|
chat_id,
|
||||||
state,
|
state,
|
||||||
download_state,
|
|
||||||
param,
|
param,
|
||||||
from_id,
|
from_id,
|
||||||
rfc724_mid,
|
rfc724_mid,
|
||||||
@@ -1804,7 +1801,6 @@ pub async fn markseen_msgs(context: &Context, msg_ids: Vec<MsgId>) -> Result<()>
|
|||||||
id,
|
id,
|
||||||
curr_chat_id,
|
curr_chat_id,
|
||||||
curr_state,
|
curr_state,
|
||||||
curr_download_state,
|
|
||||||
curr_param,
|
curr_param,
|
||||||
curr_from_id,
|
curr_from_id,
|
||||||
curr_rfc724_mid,
|
curr_rfc724_mid,
|
||||||
@@ -1814,14 +1810,7 @@ pub async fn markseen_msgs(context: &Context, msg_ids: Vec<MsgId>) -> Result<()>
|
|||||||
_curr_ephemeral_timer,
|
_curr_ephemeral_timer,
|
||||||
) in msgs
|
) in msgs
|
||||||
{
|
{
|
||||||
if curr_download_state != DownloadState::Done {
|
if curr_state == MessageState::InFresh || curr_state == MessageState::InNoticed {
|
||||||
if curr_state == MessageState::InFresh {
|
|
||||||
// Don't mark partially downloaded messages as seen or send a read receipt since
|
|
||||||
// they are not really seen by the user.
|
|
||||||
update_msg_state(context, id, MessageState::InNoticed).await?;
|
|
||||||
updated_chat_ids.insert(curr_chat_id);
|
|
||||||
}
|
|
||||||
} else if curr_state == MessageState::InFresh || curr_state == MessageState::InNoticed {
|
|
||||||
update_msg_state(context, id, MessageState::InSeen).await?;
|
update_msg_state(context, id, MessageState::InSeen).await?;
|
||||||
info!(context, "Seen message {}.", id);
|
info!(context, "Seen message {}.", id);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user