From d4a4f96a8a4cdd11f39fa770cdafdeb0f3cd3a48 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Tue, 27 Jun 2023 16:09:31 -0400 Subject: [PATCH] feat(communities): make requestCommunityInfo accept private keys Fixes #11273 Enables passing a private key as well as a public key to `RequestCommunityInfoFromMailserver`. Also fixes a small issue in the error handling in the service --- src/app/modules/main/view.nim | 3 +++ src/app_service/service/community/service.nim | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/app/modules/main/view.nim b/src/app/modules/main/view.nim index 33a90ef573..72f54ce03c 100644 --- a/src/app/modules/main/view.nim +++ b/src/app/modules/main/view.nim @@ -267,3 +267,6 @@ QtObject: proc windowDeactivated*(self: View) {.slot.} = self.delegate.windowDeactivated() + + proc setCommunityIdToSpectate*(self: View, communityId: string) {.slot.} = + self.delegate.setCommunityIdToSpectate(communityId) diff --git a/src/app_service/service/community/service.nim b/src/app_service/service/community/service.nim index 62c1e309f4..e5b547cebb 100644 --- a/src/app_service/service/community/service.nim +++ b/src/app_service/service/community/service.nim @@ -1353,7 +1353,7 @@ QtObject: proc asyncCommunityInfoLoaded*(self: Service, communityIdAndRpcResponse: string) {.slot.} = let rpcResponseObj = communityIdAndRpcResponse.parseJson - if (rpcResponseObj{"error"}.kind != JNull): + if rpcResponseObj{"error"}.kind != JNull and rpcResponseObj{"error"}.getStr != "": error "Error requesting community info", msg = rpcResponseObj{"error"} return @@ -1387,7 +1387,7 @@ QtObject: let rpcResponseObj = rpcResponse.parseJson if rpcResponseObj{"error"}.kind != JNull and rpcResponseObj{"error"}.getStr != "": let error = Json.decode($rpcResponseObj["error"], RpcError) - error "Error requesting community info", msg = error.message + error "Error checking permissions to join", msg = error.message return let communityId = rpcResponseObj{"communityId"}.getStr() @@ -1418,7 +1418,7 @@ QtObject: let rpcResponseObj = communityIdAndRpcResponse.parseJson if (rpcResponseObj{"response"}{"error"}.kind != JNull): let error = Json.decode($rpcResponseObj["response"]["error"], RpcError) - error "Error requesting community info", msg = error.message + error "Error requesting to join community", msg = error.message return let rpcResponse = Json.decode($rpcResponseObj["response"], RpcResponse[JsonNode]) @@ -1497,7 +1497,7 @@ QtObject: try: let rpcResponseObj = response.parseJson if (rpcResponseObj{"error"}.kind != JNull and rpcResponseObj{"error"}.getStr != ""): - error "Error requesting community info", msg = rpcResponseObj{"error"}.getStr + error "Error loading curated communities", msg = rpcResponseObj{"error"}.getStr self.events.emit(SIGNAL_CURATED_COMMUNITIES_LOADING_FAILED, Args()) return let curatedCommunities = parseCuratedCommunities(rpcResponseObj["response"]["result"])