From 9f3d3514af3937fb41e3dc6534571fa393fd5627 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Cie=C5=9Blak?= Date: Wed, 5 Apr 2023 13:15:57 +0200 Subject: [PATCH] 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. --- .../CommunityPermissionsSettingsPanel.qml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/ui/app/AppLayouts/Chat/panels/communities/CommunityPermissionsSettingsPanel.qml b/ui/app/AppLayouts/Chat/panels/communities/CommunityPermissionsSettingsPanel.qml index ab8a4fb4982..459074c92c7 100644 --- a/ui/app/AppLayouts/Chat/panels/communities/CommunityPermissionsSettingsPanel.qml +++ b/ui/app/AppLayouts/Chat/panels/communities/CommunityPermissionsSettingsPanel.qml @@ -213,8 +213,11 @@ SettingsPageLayout { const same = (a, b) => ModelUtils.checkEqualitySet(a, b, ["key"]) - if (holdings.rowCount() === 0 && dirtyValues.holdingsRequired) - continue + if (holdings.rowCount() === 0) + if (dirtyValues.holdingsRequired) + continue + else + return true if (holdings.rowCount() !== 0 && !dirtyValues.holdingsRequired) continue @@ -269,9 +272,11 @@ SettingsPageLayout { target: d function onSaveChanges() { - const holdings = ModelUtils.modelToArray( - dirtyValues.selectedHoldingsModel, - ["key", "type", "amount"]) + const holdings = dirtyValues.holdingsRequired ? + ModelUtils.modelToArray( + dirtyValues.selectedHoldingsModel, + ["key", "type", "amount"]) + : [] const channels = ModelUtils.modelToArray( dirtyValues.selectedChannelsModel, ["key"])