Skip to content

Commit d291204

Browse files
authored
chore(block)!: remove desktop BlockContact function for parity (#6172)
Needed for status-im/status-desktop#16640 In Desktop, we still used a "forked" version of the BlockContact function that had as differences that it didn't leave the chat nor delete the messages. However, we want to have parity now and those features, so it makes no sense to use a different function. This is a breaking change because it removes an API, but I took care of removing the use of that function in the Desktop app and Mobile never used it, so it's an inoffensive breaking change. Additionally, I added the notifications to the messenger response.
1 parent 309d17a commit d291204

File tree

2 files changed

+2
-31
lines changed

2 files changed

+2
-31
lines changed

protocol/messenger_contacts.go

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -973,38 +973,16 @@ func (m *Messenger) BlockContact(ctx context.Context, contactID string, fromSync
973973
// https://github.com/status-im/status-go/issues/3720
974974
if !fromSyncing {
975975
updatedAt := m.GetCurrentTimeInMillis()
976-
_, err = m.DismissAllActivityCenterNotificationsFromUser(ctx, contactID, updatedAt)
976+
notifications, err := m.DismissAllActivityCenterNotificationsFromUser(ctx, contactID, updatedAt)
977977
if err != nil {
978978
return nil, err
979979
}
980+
response.AddActivityCenterNotifications(notifications)
980981
}
981982

982983
return response, nil
983984
}
984985

985-
// The same function as the one above.
986-
// Should be removed with https://github.com/status-im/status-desktop/issues/8805
987-
func (m *Messenger) BlockContactDesktop(ctx context.Context, contactID string) (*MessengerResponse, error) {
988-
response := &MessengerResponse{}
989-
990-
err := m.blockContact(ctx, response, contactID, true, false)
991-
if err != nil {
992-
return nil, err
993-
}
994-
995-
response, err = m.DeclineAllPendingGroupInvitesFromUser(ctx, response, contactID)
996-
if err != nil {
997-
return nil, err
998-
}
999-
1000-
notifications, err := m.DismissAllActivityCenterNotificationsFromUser(ctx, contactID, m.GetCurrentTimeInMillis())
1001-
if err != nil {
1002-
return nil, err
1003-
}
1004-
response.AddActivityCenterNotifications(notifications)
1005-
return response, nil
1006-
}
1007-
1008986
func (m *Messenger) UnblockContact(contactID string) (*MessengerResponse, error) {
1009987
response := &MessengerResponse{}
1010988
contact, ok := m.allContacts.Load(contactID)

services/ext/api.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -345,13 +345,6 @@ func (api *PublicAPI) BlockContact(ctx context.Context, contactID string) (*prot
345345
return api.service.messenger.BlockContact(ctx, contactID, false)
346346
}
347347

348-
// This function is the same as the one above, but used only on the desktop side, since at the end it doesn't set
349-
// `Added` flag to `false`, but only `Blocked` to `true`
350-
func (api *PublicAPI) BlockContactDesktop(ctx context.Context, contactID string) (*protocol.MessengerResponse, error) {
351-
api.logger.Info("blocking contact", zap.String("contact", contactID))
352-
return api.service.messenger.BlockContactDesktop(ctx, contactID)
353-
}
354-
355348
func (api *PublicAPI) UnblockContact(parent context.Context, contactID string) (*protocol.MessengerResponse, error) {
356349
return api.service.messenger.UnblockContact(contactID)
357350
}

0 commit comments

Comments
 (0)