fix: Multiple permission update toasts are spawned
The permissions updates are done twice. Once when the permission update is called to the backend and the second time when the event for the new community description is received. The permissions are not updated anymore when the backend rpc is called. The update happens only when the community description signal is received
This commit is contained in:
parent
275d4fb349
commit
e805dd0b9c
|
@ -2183,16 +2183,6 @@ QtObject:
|
||||||
response = status_go.createCommunityTokenPermission(communityId, int(tokenPermission.`type`), Json.encode(tokenPermission.tokenCriteria), tokenPermission.chatIDs, tokenPermission.isPrivate)
|
response = status_go.createCommunityTokenPermission(communityId, int(tokenPermission.`type`), Json.encode(tokenPermission.tokenCriteria), tokenPermission.chatIDs, tokenPermission.isPrivate)
|
||||||
|
|
||||||
if response.result != nil and response.result.kind != JNull:
|
if response.result != nil and response.result.kind != JNull:
|
||||||
for permissionId, permission in response.result["communityChanges"].getElems()[0][TOKEN_PERMISSIONS_ADDED].pairs():
|
|
||||||
let p = permission.toCommunityTokenPermissionDto()
|
|
||||||
self.communities[communityId].tokenPermissions[permissionId] = p
|
|
||||||
self.events.emit(SIGNAL_COMMUNITY_TOKEN_PERMISSION_CREATED, CommunityTokenPermissionArgs(communityId: communityId, tokenPermission: p))
|
|
||||||
|
|
||||||
for permissionId, permission in response.result["communityChanges"].getElems()[0][TOKEN_PERMISSIONS_MODIFIED].pairs():
|
|
||||||
let p = permission.toCommunityTokenPermissionDto()
|
|
||||||
self.communities[communityId].tokenPermissions[permissionId] = p
|
|
||||||
self.events.emit(SIGNAL_COMMUNITY_TOKEN_PERMISSION_UPDATED, CommunityTokenPermissionArgs(communityId: communityId, tokenPermission: p))
|
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
var signal = SIGNAL_COMMUNITY_TOKEN_PERMISSION_CREATION_FAILED
|
var signal = SIGNAL_COMMUNITY_TOKEN_PERMISSION_CREATION_FAILED
|
||||||
|
@ -2207,16 +2197,6 @@ QtObject:
|
||||||
try:
|
try:
|
||||||
let response = status_go.deleteCommunityTokenPermission(communityId, permissionId)
|
let response = status_go.deleteCommunityTokenPermission(communityId, permissionId)
|
||||||
if response.result != nil and response.result.kind != JNull:
|
if response.result != nil and response.result.kind != JNull:
|
||||||
for permissionId, permission in response.result["communityChanges"].getElems()[0][TOKEN_PERMISSIONS_REMOVED].pairs():
|
|
||||||
if self.communities[communityId].tokenPermissions.hasKey(permissionId):
|
|
||||||
self.communities[communityId].tokenPermissions.del(permissionId)
|
|
||||||
self.events.emit(SIGNAL_COMMUNITY_TOKEN_PERMISSION_DELETED, CommunityTokenPermissionRemovedArgs(communityId: communityId, permissionId: permissionId))
|
|
||||||
|
|
||||||
for permissionId, permission in response.result["communityChanges"].getElems()[0][TOKEN_PERMISSIONS_MODIFIED].pairs():
|
|
||||||
let p = permission.toCommunityTokenPermissionDto()
|
|
||||||
self.communities[communityId].tokenPermissions[permissionId] = p
|
|
||||||
self.events.emit(SIGNAL_COMMUNITY_TOKEN_PERMISSION_UPDATED, CommunityTokenPermissionArgs(communityId: communityId, tokenPermission: p))
|
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
var tokenPermission = CommunityTokenPermissionDto()
|
var tokenPermission = CommunityTokenPermissionDto()
|
||||||
|
|
Loading…
Reference in New Issue