feat: Don't send a notification when a group member left (#6575)

When there is a broken group (which might happen with multi-transport),
people want to leave it.

The problem is that every "Group left" message notifies all other
members and pops up the chat, so that other members also want to leave
the group.

This PR makes it so that "Group left" messages don't create a
notification, don't cause a number-in-a-cirle badge counter on the chat,
and don't sort up the chat in the chatlist.

If a group is deleted, then the group won't pop up when someone leaves
it; this worked fine already before this PR, and there also is a test
for it.
This commit is contained in:
Hocuri
2025-02-26 19:00:46 +01:00
committed by GitHub
parent 8ffdd55f79
commit a4e478a071
6 changed files with 137 additions and 45 deletions

View File

@@ -1048,6 +1048,14 @@ impl ChatId {
Ok(count)
}
pub(crate) async fn created_timestamp(self, context: &Context) -> Result<i64> {
Ok(context
.sql
.query_get_value("SELECT created_timestamp FROM chats WHERE id=?", (self,))
.await?
.unwrap_or(0))
}
/// Returns timestamp of the latest message in the chat.
pub(crate) async fn get_timestamp(self, context: &Context) -> Result<Option<i64>> {
let timestamp = context