feat: Dispatch profile showcase message on mutual/verified contacts change (#4678)

This commit is contained in:
Mikhail Rogachev 2024-02-09 12:36:54 +03:00 committed by GitHub
parent 005e7e6ee4
commit 2350461818
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 42 additions and 0 deletions

View File

@ -451,6 +451,12 @@ func (m *Messenger) VerifiedTrusted(ctx context.Context, request *requests.Verif
return nil, err
}
// Dispatch profile message to save a contact to the encrypted profile part
err = m.DispatchProfileShowcase()
if err != nil {
return nil, err
}
response := &MessengerResponse{}
notification.ContactVerificationStatus = verification.RequestStatusTRUSTED
@ -558,6 +564,12 @@ func (m *Messenger) VerifiedUntrustworthy(ctx context.Context, request *requests
return nil, err
}
// Dispatch profile message to remove a contact from the encrypted profile part
err = m.DispatchProfileShowcase()
if err != nil {
return nil, err
}
response := &MessengerResponse{}
notification.ContactVerificationStatus = verification.RequestStatusUNTRUSTWORTHY
@ -713,6 +725,12 @@ func (m *Messenger) RemoveTrustStatus(ctx context.Context, contactID string) err
return err
}
// Dispatch profile message to remove a contact from the encrypted profile part
err = m.DispatchProfileShowcase()
if err != nil {
return err
}
return m.SyncTrustedUser(ctx, contactID, verification.TrustStatusUNKNOWN, m.dispatchMessage)
}

View File

@ -303,6 +303,12 @@ func (m *Messenger) updateAcceptedContactRequest(response *MessengerResponse, co
if err != nil {
return nil, err
}
// Dispatch profile message to add a contact to the encrypted profile part
err = m.DispatchProfileShowcase()
if err != nil {
return nil, err
}
}
if response == nil {
@ -682,6 +688,12 @@ func (m *Messenger) removeContact(ctx context.Context, response *MessengerRespon
return err
}
// Dispatch profile message to remove a contact from the encrypted profile part
err = m.DispatchProfileShowcase()
if err != nil {
return err
}
// Profile chats are deprecated.
// Code below can be removed after some reasonable time.

View File

@ -1038,6 +1038,12 @@ func (m *Messenger) handleAcceptContactRequestMessage(state *ReceivedMessageStat
return err
}
chat.UnviewedMessagesCount++
// Dispatch profile message to add a contact to the encrypted profile part
err = m.DispatchProfileShowcase()
if err != nil {
return err
}
}
state.Response.AddChat(chat)
@ -1110,6 +1116,12 @@ func (m *Messenger) handleRetractContactRequest(state *ReceivedMessageState, con
return err
}
// Dispatch profile message to remove a contact from the encrypted profile part
err = m.DispatchProfileShowcase()
if err != nil {
return err
}
err = m.prepareMessage(updateMessage, m.httpServer)
if err != nil {
return err