feat: Remove cancelOutgoingContactRequest feature (#3293)

This commit is contained in:
Mikhail Rogachev 2023-03-21 20:49:14 +07:00 committed by GitHub
parent 6775e79920
commit 81dd214e9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 0 additions and 85 deletions

View File

@ -121,66 +121,6 @@ func (m *Messenger) DeclineContactRequest(ctx context.Context, request *requests
return response, nil
}
func (m *Messenger) cancelOutgoingContactRequest(ctx context.Context, ID string) (*MessengerResponse, error) {
response := &MessengerResponse{}
// remove contact
err := m.removeContact(ctx, response, ID, true)
if err != nil {
return nil, err
}
// remove notification
notificationID := types.FromHex(defaultContactRequestID(ID))
notification, err := m.persistence.GetActivityCenterNotificationByID(notificationID)
if err != nil {
return nil, err
}
if notification != nil {
err := m.persistence.DeleteActivityCenterNotification(notificationID)
if err != nil {
return nil, err
}
}
// retract contact
clock, _ := m.getLastClockWithRelatedChat()
retractContactRequest := &protobuf.RetractContactRequest{
Clock: clock,
}
encodedMessage, err := proto.Marshal(retractContactRequest)
if err != nil {
return nil, err
}
_, err = m.dispatchMessage(context.Background(), common.RawMessage{
LocalChatID: ID,
Payload: encodedMessage,
MessageType: protobuf.ApplicationMetadataMessage_RETRACT_CONTACT_REQUEST,
ResendAutomatically: true,
})
if err != nil {
return nil, err
}
return response, nil
}
func (m *Messenger) CancelOutgoingContactRequest(ctx context.Context, request *requests.CancelOutgoingContactRequest) (*MessengerResponse, error) {
err := request.Validate()
if err != nil {
return nil, err
}
response, err := m.cancelOutgoingContactRequest(ctx, request.ID.String())
if err != nil {
return nil, err
}
return response, nil
}
func (m *Messenger) SendContactRequest(ctx context.Context, request *requests.SendContactRequest) (*MessengerResponse, error) {
err := request.Validate()
if err != nil {

View File

@ -1,21 +0,0 @@
package requests
import (
"errors"
"github.com/status-im/status-go/eth-node/types"
)
var ErrCancelOutgoingContactRequestInvalidID = errors.New("cancel-outgoing-contact-request: invalid id")
type CancelOutgoingContactRequest struct {
ID types.HexBytes `json:"id"`
}
func (a *CancelOutgoingContactRequest) Validate() error {
if len(a.ID) == 0 {
return ErrCancelOutgoingContactRequestInvalidID
}
return nil
}

View File

@ -728,10 +728,6 @@ func (api *PublicAPI) DeclineContactRequest(ctx context.Context, request *reques
return api.service.messenger.DeclineContactRequest(ctx, request)
}
func (api *PublicAPI) CancelOutgoingContactRequest(ctx context.Context, request *requests.CancelOutgoingContactRequest) (*protocol.MessengerResponse, error) {
return api.service.messenger.CancelOutgoingContactRequest(ctx, request)
}
func (api *PublicAPI) AcceptLatestContactRequestForContact(ctx context.Context, request *requests.AcceptLatestContactRequestForContact) (*protocol.MessengerResponse, error) {
return api.service.messenger.AcceptLatestContactRequestForContact(ctx, request)
}