fix errs
This commit is contained in:
parent
b64229c8b7
commit
3dc5dbb38e
|
@ -483,10 +483,10 @@ func (cp *cwtchPeer) ImportGroup(exportedInvite string) (int, error) {
|
||||||
return -1, err
|
return -1, err
|
||||||
}
|
}
|
||||||
cp.mutex.Lock()
|
cp.mutex.Lock()
|
||||||
conversationInfo, err := cp.storage.GetConversationByHandle(gci.GroupID)
|
conversationInfo, _ := cp.storage.GetConversationByHandle(gci.GroupID)
|
||||||
if conversationInfo != nil {
|
if conversationInfo != nil {
|
||||||
cp.mutex.Unlock()
|
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)
|
groupConversationID, err := cp.storage.NewConversation(gci.GroupID, map[string]string{}, model.AccessControlList{}, true)
|
||||||
cp.mutex.Unlock()
|
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) {
|
func (cp *cwtchPeer) NewContactConversation(handle string, acl model.AccessControl, accepted bool) (int, error) {
|
||||||
cp.mutex.Lock()
|
cp.mutex.Lock()
|
||||||
defer cp.mutex.Unlock()
|
defer cp.mutex.Unlock()
|
||||||
conversationInfo, err := cp.storage.GetConversationByHandle(handle)
|
conversationInfo, _ := cp.storage.GetConversationByHandle(handle)
|
||||||
if conversationInfo == nil {
|
if conversationInfo == nil {
|
||||||
conversationID, err := cp.storage.NewConversation(handle, model.Attributes{event.SaveHistoryKey: event.DeleteHistoryDefault}, model.AccessControlList{handle: acl}, accepted)
|
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}))
|
cp.eventBus.Publish(event.NewEvent(event.ContactCreated, map[event.Field]string{event.ConversationID: strconv.Itoa(conversationID), event.RemotePeer: handle}))
|
||||||
return conversationID, err
|
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`
|
// AcceptConversation looks up a conversation by `handle` and sets the Accepted status to `true`
|
||||||
|
|
Loading…
Reference in New Issue