fix errs
continuous-integration/drone/push Build is pending Details
continuous-integration/drone/pr Build is pending Details

This commit is contained in:
Dan Ballard 2022-07-30 00:19:16 -07:00
parent b64229c8b7
commit 3dc5dbb38e
1 changed files with 4 additions and 4 deletions

View File

@ -483,10 +483,10 @@ func (cp *cwtchPeer) ImportGroup(exportedInvite string) (int, error) {
return -1, err
}
cp.mutex.Lock()
conversationInfo, err := cp.storage.GetConversationByHandle(gci.GroupID)
conversationInfo, _ := cp.storage.GetConversationByHandle(gci.GroupID)
if conversationInfo != nil {
cp.mutex.Unlock()
return -1, err
return -1, fmt.Errorf("group already exists")
}
groupConversationID, err := cp.storage.NewConversation(gci.GroupID, map[string]string{}, model.AccessControlList{}, true)
cp.mutex.Unlock()
@ -506,13 +506,13 @@ func (cp *cwtchPeer) ImportGroup(exportedInvite string) (int, error) {
func (cp *cwtchPeer) NewContactConversation(handle string, acl model.AccessControl, accepted bool) (int, error) {
cp.mutex.Lock()
defer cp.mutex.Unlock()
conversationInfo, err := cp.storage.GetConversationByHandle(handle)
conversationInfo, _ := cp.storage.GetConversationByHandle(handle)
if conversationInfo == nil {
conversationID, err := cp.storage.NewConversation(handle, model.Attributes{event.SaveHistoryKey: event.DeleteHistoryDefault}, model.AccessControlList{handle: acl}, accepted)
cp.eventBus.Publish(event.NewEvent(event.ContactCreated, map[event.Field]string{event.ConversationID: strconv.Itoa(conversationID), event.RemotePeer: handle}))
return conversationID, err
}
return -1, err
return -1, fmt.Errorf("contact conversation already exists")
}
// AcceptConversation looks up a conversation by `handle` and sets the Accepted status to `true`