Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(block)!: remove desktop BlockContact function for parity #6172

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 2 additions & 24 deletions protocol/messenger_contacts.go
Original file line number Diff line number Diff line change
Expand Up @@ -973,38 +973,16 @@ func (m *Messenger) BlockContact(ctx context.Context, contactID string, fromSync
// https://github.com/status-im/status-go/issues/3720
if !fromSyncing {
updatedAt := m.GetCurrentTimeInMillis()
_, err = m.DismissAllActivityCenterNotificationsFromUser(ctx, contactID, updatedAt)
notifications, err := m.DismissAllActivityCenterNotificationsFromUser(ctx, contactID, updatedAt)
if err != nil {
return nil, err
}
response.AddActivityCenterNotifications(notifications)
}

return response, nil
}

// The same function as the one above.
// Should be removed with https://github.com/status-im/status-desktop/issues/8805
func (m *Messenger) BlockContactDesktop(ctx context.Context, contactID string) (*MessengerResponse, error) {
response := &MessengerResponse{}

err := m.blockContact(ctx, response, contactID, true, false)
if err != nil {
return nil, err
}

response, err = m.DeclineAllPendingGroupInvitesFromUser(ctx, response, contactID)
if err != nil {
return nil, err
}

notifications, err := m.DismissAllActivityCenterNotificationsFromUser(ctx, contactID, m.GetCurrentTimeInMillis())
if err != nil {
return nil, err
}
response.AddActivityCenterNotifications(notifications)
return response, nil
}

func (m *Messenger) UnblockContact(contactID string) (*MessengerResponse, error) {
response := &MessengerResponse{}
contact, ok := m.allContacts.Load(contactID)
Expand Down
7 changes: 0 additions & 7 deletions services/ext/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,13 +345,6 @@ func (api *PublicAPI) BlockContact(ctx context.Context, contactID string) (*prot
return api.service.messenger.BlockContact(ctx, contactID, false)
}

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

func (api *PublicAPI) UnblockContact(parent context.Context, contactID string) (*protocol.MessengerResponse, error) {
return api.service.messenger.UnblockContact(contactID)
}
Expand Down
Loading