mirror of
https://github.com/chatmail/core.git
synced 2026-05-02 12:56:30 +03:00
send setup-changed messages only in the chats we share with the peer, do not create contact request
This commit is contained in:
@@ -4,8 +4,8 @@ use std::collections::HashSet;
|
|||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
use crate::aheader::{Aheader, EncryptPreference};
|
use crate::aheader::{Aheader, EncryptPreference};
|
||||||
use crate::chat::{self, ChatIdBlocked};
|
use crate::chat::{self};
|
||||||
use crate::constants::Blocked;
|
use crate::chatlist::Chatlist;
|
||||||
use crate::context::Context;
|
use crate::context::Context;
|
||||||
use crate::events::EventType;
|
use crate::events::EventType;
|
||||||
use crate::key::{DcKey, Fingerprint, SignedPublicKey};
|
use crate::key::{DcKey, Fingerprint, SignedPublicKey};
|
||||||
@@ -271,14 +271,15 @@ impl Peerstate {
|
|||||||
.query_get_value("SELECT id FROM contacts WHERE addr=?;", paramsv![self.addr])
|
.query_get_value("SELECT id FROM contacts WHERE addr=?;", paramsv![self.addr])
|
||||||
.await?
|
.await?
|
||||||
{
|
{
|
||||||
let chat_id = ChatIdBlocked::get_for_contact(context, contact_id, Blocked::Request)
|
let chats = Chatlist::try_load(context, 0, None, contact_id)
|
||||||
.await?
|
.await
|
||||||
.id;
|
.unwrap();
|
||||||
|
|
||||||
let msg = stock_str::contact_setup_changed(context, self.addr.clone()).await;
|
let msg = stock_str::contact_setup_changed(context, self.addr.clone()).await;
|
||||||
|
for chat_index in 0..chats.len() {
|
||||||
chat::add_info_msg(context, chat_id, &msg, timestamp).await?;
|
let chat_id = chats.get_chat_id(chat_index).unwrap();
|
||||||
context.emit_event(EventType::ChatModified(chat_id));
|
chat::add_info_msg(context, chat_id, &msg, timestamp).await?;
|
||||||
|
context.emit_event(EventType::ChatModified(chat_id));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
bail!("contact with peerstate.addr {:?} not found", &self.addr);
|
bail!("contact with peerstate.addr {:?} not found", &self.addr);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user