mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-24 05:21:58 +00:00
fix(CommunityPermissions): Fix token criteria updates in the permissions model
Re-create the token criteria and include all items whenever the model changes. The previous perf optimisation fix filtered the items where the criteriaMet doesn't change.
This commit is contained in:
parent
75e1d3151f
commit
a9a83df301
@ -933,12 +933,13 @@ proc updateTokenPermissionModel*(self: Module, permissions: Table[string, CheckP
|
||||
|
||||
var updatedTokenCriteriaItems: seq[TokenCriteriaItem] = @[]
|
||||
var permissionSatisfied = true
|
||||
var aCriteriaChanged = false
|
||||
|
||||
for index, tokenCriteriaItem in tokenPermissionItem.getTokenCriteria().getItems():
|
||||
let criteriaMet = criteriaResult.criteria[index]
|
||||
|
||||
if tokenCriteriaItem.criteriaMet == criteriaMet:
|
||||
continue
|
||||
if tokenCriteriaItem.criteriaMet != criteriaMet:
|
||||
aCriteriaChanged = true
|
||||
|
||||
let updatedTokenCriteriaItem = initTokenCriteriaItem(
|
||||
tokenCriteriaItem.symbol,
|
||||
@ -954,7 +955,7 @@ proc updateTokenPermissionModel*(self: Module, permissions: Table[string, CheckP
|
||||
|
||||
updatedTokenCriteriaItems.add(updatedTokenCriteriaItem)
|
||||
|
||||
if updatedTokenCriteriaItems.len == 0:
|
||||
if not aCriteriaChanged:
|
||||
continue
|
||||
|
||||
thereWasAnUpdate = true
|
||||
|
@ -899,13 +899,13 @@ proc applyPermissionResponse*(self: Module, communityId: string, permissions: Ta
|
||||
|
||||
var updatedTokenCriteriaItems: seq[TokenCriteriaItem] = @[]
|
||||
var permissionSatisfied = true
|
||||
var aCriteriaChanged = false
|
||||
|
||||
for index, tokenCriteriaItem in tokenPermissionItem.getTokenCriteria().getItems():
|
||||
let criteriaMet = criteriaResult.criteria[index]
|
||||
|
||||
if tokenCriteriaItem.criteriaMet == criteriaMet:
|
||||
continue
|
||||
|
||||
if tokenCriteriaItem.criteriaMet != criteriaMet:
|
||||
aCriteriaChanged = true
|
||||
|
||||
let updatedTokenCriteriaItem = initTokenCriteriaItem(
|
||||
tokenCriteriaItem.symbol,
|
||||
@ -921,8 +921,9 @@ proc applyPermissionResponse*(self: Module, communityId: string, permissions: Ta
|
||||
|
||||
updatedTokenCriteriaItems.add(updatedTokenCriteriaItem)
|
||||
|
||||
if updatedTokenCriteriaItems.len == 0:
|
||||
if not aCriteriaChanged:
|
||||
continue
|
||||
|
||||
let updatedTokenPermissionItem = initTokenPermissionItem(
|
||||
tokenPermissionItem.id,
|
||||
tokenPermissionItem.`type`,
|
||||
|
Loading…
x
Reference in New Issue
Block a user