chore: add safeguards when checking for community data in response
Also remove unnecessary signals
This commit is contained in:
parent
3f71e1fe87
commit
348516d5a5
|
@ -17,13 +17,11 @@ QtObject:
|
|||
|
||||
proc membersChanged*(self: ActiveSection) {.signal.}
|
||||
proc pendingRequestsToJoinChanged*(self: ActiveSection) {.signal.}
|
||||
proc historyArchiveSupportEnabledChanged*(self: ActiveSection) {.signal.}
|
||||
|
||||
proc setActiveSectionData*(self: ActiveSection, item: SectionItem) =
|
||||
self.item = item
|
||||
self.membersChanged()
|
||||
self.pendingRequestsToJoinChanged()
|
||||
self.historyArchiveSupportEnabledChanged()
|
||||
|
||||
proc getId*(self: ActiveSection): string {.slot.} =
|
||||
return self.item.id
|
||||
|
|
|
@ -424,6 +424,14 @@ QtObject:
|
|||
error "error: ", procName="joinCommunity", errDesription = "result is nil"
|
||||
return
|
||||
|
||||
if not response.result.hasKey("communities") or response.result["communities"].kind != JArray or response.result["communities"].len == 0:
|
||||
error "error: ", procName="joinCommunity", errDesription = "no 'communities' key in response"
|
||||
return
|
||||
|
||||
if not response.result.hasKey("communitiesSettings") or response.result["communitiesSettings"].kind != JArray or response.result["communitiesSettings"].len == 0:
|
||||
error "error: ", procName="joinCommunity", errDesription = "no 'communitiesSettings' key in response"
|
||||
return
|
||||
|
||||
var updatedCommunity = response.result["communities"][0].toCommunityDto()
|
||||
let communitySettings = response.result["communitiesSettings"][0].toCommunitySettingsDto()
|
||||
|
||||
|
|
Loading…
Reference in New Issue