fix(Communities): ensure importCommunity API returns response

Prior to this commit we were ignoring the returned response of the
API call, making it impossible to work with it in case it's needed.
This commit is contained in:
Pascal Precht 2021-03-10 15:22:45 +01:00 committed by Iuri Matias
parent 01d3369c64
commit 99dfd7b13a
3 changed files with 7 additions and 6 deletions

View File

@ -278,11 +278,12 @@ QtObject:
error "Error exporting the community", msg = e.msg
result = fmt"Error exporting the community: {e.msg}"
proc importCommunity*(self: CommunitiesView, communityKey: string) {.slot.} =
proc importCommunity*(self: CommunitiesView, communityKey: string): string {.slot.} =
try:
self.status.chat.importCommunity(communityKey)
discard self.status.chat.importCommunity(communityKey)
except Exception as e:
error "Error importing the community", msg = e.msg
result = fmt"Error importing the community: {e.msg}"
proc removeUserFromCommunity*(self: CommunitiesView, pubKey: string) {.slot.} =
try:

View File

@ -440,8 +440,8 @@ proc removeUserFromCommunity*(self: ChatModel, communityId: string, pubKey: stri
proc exportCommunity*(self: ChatModel, communityId: string): string =
result = status_chat.exportCommunity(communityId)
proc importCommunity*(self: ChatModel, communityKey: string) =
status_chat.importCommunity(communityKey)
proc importCommunity*(self: ChatModel, communityKey: string): string =
result = status_chat.importCommunity(communityKey)
proc requestToJoinCommunity*(self: ChatModel, communityKey: string, ensName: string): seq[CommunityMembershipRequest] =
status_chat.requestToJoinCommunity(communityKey, ensName)

View File

@ -315,8 +315,8 @@ proc inviteUsersToCommunity*(communityId: string, pubKeys: seq[string]) =
proc exportCommunity*(communityId: string):string =
result = callPrivateRPC("exportCommunity".prefix, %*[communityId]).parseJson()["result"].getStr
proc importCommunity*(communityKey: string) =
discard callPrivateRPC("importCommunity".prefix, %*[communityKey])
proc importCommunity*(communityKey: string): string =
return callPrivateRPC("importCommunity".prefix, %*[communityKey])
proc removeUserFromCommunity*(communityId: string, pubKey: string) =
discard callPrivateRPC("removeUserFromCommunity".prefix, %*[communityId, pubKey])