mirror of
https://github.com/chatmail/core.git
synced 2026-05-09 01:46:30 +03:00
fix: Synchronise self-chat
It just didn't work before, sync messages were not generated.
This commit is contained in:
@@ -1877,7 +1877,7 @@ impl Chat {
|
|||||||
Chattype::Single => {
|
Chattype::Single => {
|
||||||
let mut r = None;
|
let mut r = None;
|
||||||
for contact_id in get_chat_contacts(context, self.id).await? {
|
for contact_id in get_chat_contacts(context, self.id).await? {
|
||||||
if contact_id == ContactId::SELF {
|
if contact_id == ContactId::SELF && !self.is_self_talk() {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if r.is_some() {
|
if r.is_some() {
|
||||||
|
|||||||
12
src/sync.rs
12
src/sync.rs
@@ -615,17 +615,23 @@ mod tests {
|
|||||||
sync(&alices).await?;
|
sync(&alices).await?;
|
||||||
assert!(!alices[1].add_or_lookup_contact(&bob).await.is_blocked());
|
assert!(!alices[1].add_or_lookup_contact(&bob).await.is_blocked());
|
||||||
|
|
||||||
|
// Test syncing of chat visibility on a self-chat. This way we test:
|
||||||
|
// - Self-chat synchronisation.
|
||||||
|
// - That sync messages don't unarchive the self-chat.
|
||||||
|
let a0self_chat_id = alices[0].get_self_chat().await.id;
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
alices[1].get_chat(&bob).await.get_visibility(),
|
alices[1].get_self_chat().await.get_visibility(),
|
||||||
ChatVisibility::Normal
|
ChatVisibility::Normal
|
||||||
);
|
);
|
||||||
let mut visibilities =
|
let mut visibilities =
|
||||||
ChatVisibility::iter().chain(std::iter::once(ChatVisibility::Normal));
|
ChatVisibility::iter().chain(std::iter::once(ChatVisibility::Normal));
|
||||||
visibilities.next();
|
visibilities.next();
|
||||||
for v in visibilities {
|
for v in visibilities {
|
||||||
a0b_chat_id.set_visibility(&alices[0], v).await?;
|
a0self_chat_id.set_visibility(&alices[0], v).await?;
|
||||||
sync(&alices).await?;
|
sync(&alices).await?;
|
||||||
assert_eq!(alices[1].get_chat(&bob).await.get_visibility(), v);
|
for a in &alices {
|
||||||
|
assert_eq!(a.get_self_chat().await.get_visibility(), v);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
use chat::MuteDuration;
|
use chat::MuteDuration;
|
||||||
|
|||||||
Reference in New Issue
Block a user