Remove contact from the contact list of contacts the blocked contact
* Remove contact from the user's list of contacts when the contact is blocked by the user * added test for removed blocked contact
This commit is contained in:
parent
272173c939
commit
9dea0aaee3
|
@ -155,6 +155,7 @@ func (c Contact) PublicKey() (*ecdsa.PublicKey, error) {
|
||||||
func (c *Contact) Block(clock uint64) {
|
func (c *Contact) Block(clock uint64) {
|
||||||
c.Blocked = true
|
c.Blocked = true
|
||||||
c.DismissContactRequest(clock)
|
c.DismissContactRequest(clock)
|
||||||
|
c.Removed = true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Contact) BlockDesktop() {
|
func (c *Contact) BlockDesktop() {
|
||||||
|
|
|
@ -669,6 +669,11 @@ func (m *Messenger) blockContact(contactID string, isDesktopFunc bool) ([]*Chat,
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err = m.sendRetractContactRequest(contact)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
m.allContacts.Store(contact.ID, contact)
|
m.allContacts.Store(contact.ID, contact)
|
||||||
for _, chat := range chats {
|
for _, chat := range chats {
|
||||||
m.allChats.Store(chat.ID, chat)
|
m.allChats.Store(chat.ID, chat)
|
||||||
|
|
|
@ -1378,6 +1378,9 @@ func (s *MessengerSuite) TestBlockContact() {
|
||||||
response, err := s.m.BlockContact(contact.ID)
|
response, err := s.m.BlockContact(contact.ID)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
|
|
||||||
|
blockedContacts := s.m.BlockedContacts()
|
||||||
|
s.Require().True(blockedContacts[0].Removed)
|
||||||
|
|
||||||
chats := response.Chats()
|
chats := response.Chats()
|
||||||
|
|
||||||
var actualChat2, actualChat3 *Chat
|
var actualChat2, actualChat3 *Chat
|
||||||
|
|
Loading…
Reference in New Issue