fix(CommunityPermissionsSettingsPanel): fixing duplicates detection and permission updating

It's integral part of
https://github.com/status-im/status-desktop/pull/10166 but not pushed
together by mistake.
This commit is contained in:
Michał Cieślak 2023-04-05 13:15:57 +02:00 committed by Michał
parent ac01824ad5
commit 9f3d3514af
1 changed files with 10 additions and 5 deletions

View File

@ -213,8 +213,11 @@ SettingsPageLayout {
const same = (a, b) => ModelUtils.checkEqualitySet(a, b, ["key"]) const same = (a, b) => ModelUtils.checkEqualitySet(a, b, ["key"])
if (holdings.rowCount() === 0 && dirtyValues.holdingsRequired) if (holdings.rowCount() === 0)
if (dirtyValues.holdingsRequired)
continue continue
else
return true
if (holdings.rowCount() !== 0 && !dirtyValues.holdingsRequired) if (holdings.rowCount() !== 0 && !dirtyValues.holdingsRequired)
continue continue
@ -269,9 +272,11 @@ SettingsPageLayout {
target: d target: d
function onSaveChanges() { function onSaveChanges() {
const holdings = ModelUtils.modelToArray( const holdings = dirtyValues.holdingsRequired ?
ModelUtils.modelToArray(
dirtyValues.selectedHoldingsModel, dirtyValues.selectedHoldingsModel,
["key", "type", "amount"]) ["key", "type", "amount"])
: []
const channels = ModelUtils.modelToArray( const channels = ModelUtils.modelToArray(
dirtyValues.selectedChannelsModel, ["key"]) dirtyValues.selectedChannelsModel, ["key"])