Skip to content

Commit

Permalink
fix: remove contact with no conversation 1-1
Browse files Browse the repository at this point in the history
Signed-off-by: Godefroy Ponsinet <godefroy.ponsinet@outlook.com>
  • Loading branch information
90dy committed Dec 27, 2018
1 parent a896432 commit d81dc0b
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions core/node/nodeapi.go
Expand Up @@ -334,14 +334,12 @@ func (n *Node) ContactRemove(ctx context.Context, contact *entity.Contact) (*ent
return nil, errorcodes.ErrDbDelete.Wrap(err)
}

conversation, err := bsql.ConversationOneToOne(sql, n.config.Myself.ID, contact.ID)
if err != nil {
return nil, err
}

// remove 1-1 conversation
// don't return error if not found
n.ConversationRemove(ctx, &entity.Conversation{ID: conversation.ID})
conversation, err := bsql.ConversationOneToOne(sql, n.config.Myself.ID, contact.ID)
if err == nil {
n.ConversationRemove(ctx, &entity.Conversation{ID: conversation.ID})
}

return contact, nil
}
Expand Down

0 comments on commit d81dc0b

Please sign in to comment.