chore: cleanup community code
This commit is contained in:
parent
a90a30af11
commit
d48043ee22
|
@ -215,7 +215,6 @@ proc getLinkPreviewData*(link: string): JsonNode =
|
||||||
proc getAllComunities*(): seq[Community] =
|
proc getAllComunities*(): seq[Community] =
|
||||||
var communities: seq[Community] = @[]
|
var communities: seq[Community] = @[]
|
||||||
let rpcResult = callPrivateRPC("communities".prefix).parseJSON()
|
let rpcResult = callPrivateRPC("communities".prefix).parseJSON()
|
||||||
debug "LIST", rpcResult
|
|
||||||
if rpcResult{"result"}.kind != JNull:
|
if rpcResult{"result"}.kind != JNull:
|
||||||
for jsonCommunity in rpcResult["result"]:
|
for jsonCommunity in rpcResult["result"]:
|
||||||
var community = jsonCommunity.toCommunity()
|
var community = jsonCommunity.toCommunity()
|
||||||
|
@ -226,7 +225,6 @@ proc getAllComunities*(): seq[Community] =
|
||||||
proc getJoinedComunities*(): seq[Community] =
|
proc getJoinedComunities*(): seq[Community] =
|
||||||
var communities: seq[Community] = @[]
|
var communities: seq[Community] = @[]
|
||||||
let rpcResult = callPrivateRPC("joinedCommunities".prefix).parseJSON()
|
let rpcResult = callPrivateRPC("joinedCommunities".prefix).parseJSON()
|
||||||
debug "LIST", rpcResult
|
|
||||||
if rpcResult{"result"}.kind != JNull:
|
if rpcResult{"result"}.kind != JNull:
|
||||||
for jsonCommunity in rpcResult["result"]:
|
for jsonCommunity in rpcResult["result"]:
|
||||||
var community = jsonCommunity.toCommunity()
|
var community = jsonCommunity.toCommunity()
|
||||||
|
@ -253,7 +251,6 @@ proc createCommunity*(name: string, description: string, color: string, image: s
|
||||||
# ]
|
# ]
|
||||||
}
|
}
|
||||||
}]).parseJSON()
|
}]).parseJSON()
|
||||||
debug "RESULT", rpcResult
|
|
||||||
|
|
||||||
if rpcResult{"result"}.kind != JNull:
|
if rpcResult{"result"}.kind != JNull:
|
||||||
result = rpcResult["result"]["communities"][0].toCommunity()
|
result = rpcResult["result"]["communities"][0].toCommunity()
|
||||||
|
@ -279,7 +276,6 @@ proc createCommunityChannel*(communityId: string, name: string, description: str
|
||||||
# ]
|
# ]
|
||||||
}
|
}
|
||||||
}]).parseJSON()
|
}]).parseJSON()
|
||||||
debug "RESULT", rpcResult
|
|
||||||
|
|
||||||
if rpcResult{"result"}.kind != JNull:
|
if rpcResult{"result"}.kind != JNull:
|
||||||
result = rpcResult["result"]["chats"][0].toChat()
|
result = rpcResult["result"]["chats"][0].toChat()
|
||||||
|
@ -291,20 +287,16 @@ proc createCommunityChannel*(communityId: string, name: string, description: str
|
||||||
# result = rpcResult["result"]["communities"][0].toCommunity()
|
# result = rpcResult["result"]["communities"][0].toCommunity()
|
||||||
|
|
||||||
proc joinCommunity*(communityId: string) =
|
proc joinCommunity*(communityId: string) =
|
||||||
let res = callPrivateRPC("joinCommunity".prefix, %*[communityId])#.parseJSON()["result"]
|
discard callPrivateRPC("joinCommunity".prefix, %*[communityId])
|
||||||
debug "RESULT", res
|
|
||||||
|
|
||||||
proc leaveCommunity*(communityId: string) =
|
proc leaveCommunity*(communityId: string) =
|
||||||
let res = callPrivateRPC("leaveCommunity".prefix, %*[communityId])#.parseJSON()["result"]
|
discard callPrivateRPC("leaveCommunity".prefix, %*[communityId])
|
||||||
debug "RESULT", res
|
|
||||||
|
|
||||||
proc inviteUserToCommunity*(communityId: string, pubKey: string) =
|
proc inviteUserToCommunity*(communityId: string, pubKey: string) =
|
||||||
let res = callPrivateRPC("inviteUserToCommunity".prefix, %*[communityId, pubKey])#.parseJSON()["result"]
|
discard callPrivateRPC("inviteUserToCommunity".prefix, %*[communityId, pubKey])
|
||||||
debug "RESULT", res
|
|
||||||
|
|
||||||
proc exportCommunity*(communityId: string):string =
|
proc exportCommunity*(communityId: string):string =
|
||||||
result = callPrivateRPC("exportCommunity".prefix, %*[communityId]).parseJson()["result"].getStr
|
result = callPrivateRPC("exportCommunity".prefix, %*[communityId]).parseJson()["result"].getStr
|
||||||
|
|
||||||
proc importCommunity*(communityKey: string) =
|
proc importCommunity*(communityKey: string) =
|
||||||
let res = callPrivateRPC("importCommunity".prefix, %*[communityKey])
|
discard callPrivateRPC("importCommunity".prefix, %*[communityKey])
|
||||||
debug "RESULT", res
|
|
|
@ -57,7 +57,7 @@ ModalPopup {
|
||||||
return creatingError.open()
|
return creatingError.open()
|
||||||
}
|
}
|
||||||
|
|
||||||
// popup.close()
|
popup.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageDialog {
|
MessageDialog {
|
||||||
|
|
Loading…
Reference in New Issue