set message-state OutMdnRcvd on first read-receipt (#2699)

in the past, group-messages were marked as "read by recipient"
only when at least 50% of the group members have send a read receipt -
in practise, this does happen never or much too late esp. in larger groups.

setting the state OutMdnRcvd already on the first read-receipt
seems to be much more intuitive and useful as you at least know
one person has read the message.

this is also what other messengers as telegram are doing here.

moreover, this fixes a bug that did not add all read-receipts
to the "Info" screen - once "enough" read-receipts were received,
and the state was already set to OutMdnRcvd, subsequent read-receipts
were ignored.
probably because the "Info" screen did not show the read-receipts since forever -
and for the second tick, the addutional read-receipts are not needed.
This commit is contained in:
bjoern
2021-09-27 13:39:27 +02:00
committed by GitHub
parent acbf363fc8
commit 95bce993ad
2 changed files with 19 additions and 67 deletions

View File

@@ -2758,17 +2758,6 @@ pub async fn forward_msgs(context: &Context, msg_ids: &[MsgId], chat_id: ChatId)
Ok(())
}
pub(crate) async fn get_chat_contact_cnt(context: &Context, chat_id: ChatId) -> Result<usize> {
let count = context
.sql
.count(
"SELECT COUNT(*) FROM chats_contacts WHERE chat_id=?;",
paramsv![chat_id],
)
.await?;
Ok(count as usize)
}
pub(crate) async fn get_chat_cnt(context: &Context) -> Result<usize> {
if context.sql.is_open().await {
// no database, no chats - this is no error (needed eg. for information)