fix(Profile): fix requesting empty profile showcase (#13564)
This commit is contained in:
parent
40e00c0602
commit
6d9be9b49d
|
@ -78,16 +78,21 @@ proc toProfileShowcaseDto*(jsonObj: JsonNode): ProfileShowcaseDto =
|
|||
|
||||
discard jsonObj.getProp("contactId", result.contactId)
|
||||
|
||||
for jsonMsg in jsonObj["communities"]:
|
||||
result.communities.add(jsonMsg.toProfileShowcaseCommunity())
|
||||
for jsonMsg in jsonObj["accounts"]:
|
||||
result.accounts.add(jsonMsg.toProfileShowcaseAccount())
|
||||
for jsonMsg in jsonObj["collectibles"]:
|
||||
result.collectibles.add(jsonMsg.toProfileShowcaseCollectible())
|
||||
for jsonMsg in jsonObj["verifiedTokens"]:
|
||||
result.verifiedTokens.add(jsonMsg.toProfileShowcaseVerifiedToken())
|
||||
for jsonMsg in jsonObj["unverifiedTokens"]:
|
||||
result.unverifiedTokens.add(jsonMsg.toProfileShowcaseUnverifiedToken())
|
||||
if jsonObj["communities"].kind != JNull:
|
||||
for jsonMsg in jsonObj["communities"]:
|
||||
result.communities.add(jsonMsg.toProfileShowcaseCommunity())
|
||||
if jsonObj["accounts"].kind != JNull:
|
||||
for jsonMsg in jsonObj["accounts"]:
|
||||
result.accounts.add(jsonMsg.toProfileShowcaseAccount())
|
||||
if jsonObj["collectibles"].kind != JNull:
|
||||
for jsonMsg in jsonObj["collectibles"]:
|
||||
result.collectibles.add(jsonMsg.toProfileShowcaseCollectible())
|
||||
if jsonObj["verifiedTokens"].kind != JNull:
|
||||
for jsonMsg in jsonObj["verifiedTokens"]:
|
||||
result.verifiedTokens.add(jsonMsg.toProfileShowcaseVerifiedToken())
|
||||
if jsonObj["unverifiedTokens"].kind != JNull:
|
||||
for jsonMsg in jsonObj["unverifiedTokens"]:
|
||||
result.unverifiedTokens.add(jsonMsg.toProfileShowcaseUnverifiedToken())
|
||||
|
||||
proc `%`*(x: ProfileShowcaseAccount): JsonNode =
|
||||
result = newJobject()
|
||||
|
|
|
@ -141,16 +141,21 @@ proc toJsonNode*(self: ProfileShowcaseUnverifiedTokenPreference): JsonNode =
|
|||
proc toProfileShowcasePreferencesDto*(jsonObj: JsonNode): ProfileShowcasePreferencesDto =
|
||||
result = ProfileShowcasePreferencesDto()
|
||||
|
||||
for jsonMsg in jsonObj["communities"]:
|
||||
result.communities.add(jsonMsg.toProfileShowcaseCommunityPreference())
|
||||
for jsonMsg in jsonObj["accounts"]:
|
||||
result.accounts.add(jsonMsg.toProfileShowcaseAccountPreference())
|
||||
for jsonMsg in jsonObj["collectibles"]:
|
||||
result.collectibles.add(jsonMsg.toProfileShowcaseCollectiblePreference())
|
||||
for jsonMsg in jsonObj["verifiedTokens"]:
|
||||
result.verifiedTokens.add(jsonMsg.toProfileShowcaseVerifiedTokenPreference())
|
||||
for jsonMsg in jsonObj["unverifiedTokens"]:
|
||||
result.unverifiedTokens.add(jsonMsg.toProfileShowcaseUnverifiedTokenPreference())
|
||||
if jsonObj["communities"].kind != JNull:
|
||||
for jsonMsg in jsonObj["communities"]:
|
||||
result.communities.add(jsonMsg.toProfileShowcaseCommunityPreference())
|
||||
if jsonObj["accounts"].kind != JNull:
|
||||
for jsonMsg in jsonObj["accounts"]:
|
||||
result.accounts.add(jsonMsg.toProfileShowcaseAccountPreference())
|
||||
if jsonObj["collectibles"].kind != JNull:
|
||||
for jsonMsg in jsonObj["collectibles"]:
|
||||
result.collectibles.add(jsonMsg.toProfileShowcaseCollectiblePreference())
|
||||
if jsonObj["verifiedTokens"].kind != JNull:
|
||||
for jsonMsg in jsonObj["verifiedTokens"]:
|
||||
result.verifiedTokens.add(jsonMsg.toProfileShowcaseVerifiedTokenPreference())
|
||||
if jsonObj["unverifiedTokens"].kind != JNull:
|
||||
for jsonMsg in jsonObj["unverifiedTokens"]:
|
||||
result.unverifiedTokens.add(jsonMsg.toProfileShowcaseUnverifiedTokenPreference())
|
||||
|
||||
proc toJsonNode*(self: ProfileShowcasePreferencesDto): JsonNode =
|
||||
let communities = self.communities.map(entry => entry.toJsonNode())
|
||||
|
|
|
@ -119,7 +119,7 @@ QtObject:
|
|||
try:
|
||||
let rpcResponseObj = rpcResponse.parseJson
|
||||
if rpcResponseObj{"error"}.kind != JNull and rpcResponseObj{"error"}.getStr != "":
|
||||
error "Error requesting profile showcase preferences", msg = rpcResponseObj{"error"}
|
||||
error "Error requesting profile showcase for a contact", msg = rpcResponseObj{"error"}
|
||||
return
|
||||
|
||||
let profileShowcase = rpcResponseObj["response"]["result"].toProfileShowcaseDto()
|
||||
|
|
Loading…
Reference in New Issue