From 85dd85d56d8c93f140f2bc04a2ae9809b8f89a1d Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Mon, 4 Nov 2024 13:24:48 -0500 Subject: [PATCH] fix(community): fix community images not updating without a force reset Fixes #16688 --- .../modules/shared_models/section_model.nim | 22 +++++++++++++++++-- .../Components/StatusSmartIdenticon.qml | 1 + .../src/StatusQ/Core/StatusAssetSettings.qml | 1 + .../Chat/views/ChatHeaderContentView.qml | 1 + .../Communities/panels/ColumnHeaderPanel.qml | 1 + .../panels/JoinCommunityHeaderPanel.qml | 1 + .../views/CommunitySettingsView.qml | 1 + ui/app/mainui/AppMain.qml | 1 + .../shared/panels/EditCroppedImagePanel.qml | 1 + .../shared/popups/ImportCommunityPopup.qml | 1 + vendor/status-go | 2 +- 11 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/app/modules/shared_models/section_model.nim b/src/app/modules/shared_models/section_model.nim index 757cd71be7..1bdf70a04a 100644 --- a/src/app/modules/shared_models/section_model.nim +++ b/src/app/modules/shared_models/section_model.nim @@ -327,11 +327,29 @@ QtObject: self.items[ind].members.updateToTheseItems(item.members.getItems()) + let dataIndex = self.createIndex(ind, 0, nil) + defer: dataIndex.delete + + # Images come in the form of local URLs that do not change when they get updated + # eg: localhost://communityId="0x1234...890"&format="thumbnail" + # This means that the iamge won't update unless forced to + if item.image != "" and self.items[ind].image == item.image: + self.items[ind].image = "" + self.dataChanged(dataIndex, dataIndex, @[ModelRole.Image.int]) + + self.items[ind].image = item.image + roles.add(ModelRole.Image.int) + # Same thing for the banner + if item.bannerImageData != "" and self.items[ind].bannerImageData == item.bannerImageData: + self.items[ind].bannerImageData = "" + self.dataChanged(dataIndex, dataIndex, @[ModelRole.BannerImageData.int]) + + self.items[ind].bannerImageData = item.bannerImageData + roles.add(ModelRole.BannerImageData.int) + if roles.len == 0: return - let dataIndex = self.createIndex(ind, 0, nil) - defer: dataIndex.delete self.dataChanged(dataIndex, dataIndex, roles) proc updateMemberItemInSections*( diff --git a/ui/StatusQ/src/StatusQ/Components/StatusSmartIdenticon.qml b/ui/StatusQ/src/StatusQ/Components/StatusSmartIdenticon.qml index 90180869ca..315ed50927 100644 --- a/ui/StatusQ/src/StatusQ/Components/StatusSmartIdenticon.qml +++ b/ui/StatusQ/src/StatusQ/Components/StatusSmartIdenticon.qml @@ -54,6 +54,7 @@ Loader { width: parent.width height: parent.height image.source: root.asset.isImage ? root.asset.name : "" + image.cache: root.asset.cache showLoadingIndicator: true border.width: root.asset.imgIsIdenticon ? 1 : 0 border.color: Theme.palette.directColor7 diff --git a/ui/StatusQ/src/StatusQ/Core/StatusAssetSettings.qml b/ui/StatusQ/src/StatusQ/Core/StatusAssetSettings.qml index f759d259c1..066ee5d25a 100644 --- a/ui/StatusQ/src/StatusQ/Core/StatusAssetSettings.qml +++ b/ui/StatusQ/src/StatusQ/Core/StatusAssetSettings.qml @@ -40,6 +40,7 @@ QtObject { property bool isImage: isImgSrc(root.name) property int imgStatus property bool imgIsIdenticon: false + property bool cache: true // ring settings hints readonly property real ringPxSize: Math.max(1.5, root.width / 24.0) diff --git a/ui/app/AppLayouts/Chat/views/ChatHeaderContentView.qml b/ui/app/AppLayouts/Chat/views/ChatHeaderContentView.qml index 2cb42eb9fe..77dfafe875 100644 --- a/ui/app/AppLayouts/Chat/views/ChatHeaderContentView.qml +++ b/ui/app/AppLayouts/Chat/views/ChatHeaderContentView.qml @@ -290,6 +290,7 @@ Item { asset.name: assetName asset.isImage: chatContentModule && chatContentModule.chatDetails.icon !== "" asset.isLetterIdenticon: chatContentModule && chatContentModule.chatDetails.icon === "" + asset.cache: false ringSettings.ringSpecModel: chatContentModule && chatContentModule.chatDetails.type === Constants.chatType.oneToOne ? Utils.getColorHashAsJson(chatContentModule.chatDetails.id) : "" asset.color: chatContentModule? diff --git a/ui/app/AppLayouts/Communities/panels/ColumnHeaderPanel.qml b/ui/app/AppLayouts/Communities/panels/ColumnHeaderPanel.qml index b1be34088c..cfe464da9e 100644 --- a/ui/app/AppLayouts/Communities/panels/ColumnHeaderPanel.qml +++ b/ui/app/AppLayouts/Communities/panels/ColumnHeaderPanel.qml @@ -34,6 +34,7 @@ Control { asset.name: root.image asset.color: root.color asset.isImage: true + asset.cache: false type: StatusChatInfoButton.Type.OneToOneChat hoverEnabled: root.amISectionAdmin onClicked: if(root.amISectionAdmin) root.infoButtonClicked() diff --git a/ui/app/AppLayouts/Communities/panels/JoinCommunityHeaderPanel.qml b/ui/app/AppLayouts/Communities/panels/JoinCommunityHeaderPanel.qml index cbc1dc81fd..12f9409efa 100644 --- a/ui/app/AppLayouts/Communities/panels/JoinCommunityHeaderPanel.qml +++ b/ui/app/AppLayouts/Communities/panels/JoinCommunityHeaderPanel.qml @@ -30,6 +30,7 @@ RowLayout { title: root.joinCommunity ? root.name : root.channelName subTitle: root.joinCommunity ? root.communityDesc : root.channelDesc asset.color: root.color + asset.cache: false enabled: false type: StatusChatInfoButton.Type.CommunityChat layer.enabled: root.joinCommunity // Blured when joining community but not when entering channel diff --git a/ui/app/AppLayouts/Communities/views/CommunitySettingsView.qml b/ui/app/AppLayouts/Communities/views/CommunitySettingsView.qml index b977df8497..17a48e3d71 100644 --- a/ui/app/AppLayouts/Communities/views/CommunitySettingsView.qml +++ b/ui/app/AppLayouts/Communities/views/CommunitySettingsView.qml @@ -118,6 +118,7 @@ StatusSectionLayout { asset.name: community.image asset.color: community.color asset.isImage: true + asset.cache: false Layout.fillWidth: true Layout.leftMargin: Theme.halfPadding Layout.rightMargin: Theme.halfPadding diff --git a/ui/app/mainui/AppMain.qml b/ui/app/mainui/AppMain.qml index ff0be0d876..8aaee96212 100644 --- a/ui/app/mainui/AppMain.qml +++ b/ui/app/mainui/AppMain.qml @@ -704,6 +704,7 @@ Item { icon.name: model.icon icon.source: model.image identicon.asset.color: (hovered || identicon.highlighted || checked) ? model.color : icon.color + identicon.asset.cache: false tooltip.text: model.name checked: model.active badge.value: model.notificationsCount diff --git a/ui/imports/shared/panels/EditCroppedImagePanel.qml b/ui/imports/shared/panels/EditCroppedImagePanel.qml index 9ad1d4c073..53292665b7 100644 --- a/ui/imports/shared/panels/EditCroppedImagePanel.qml +++ b/ui/imports/shared/panels/EditCroppedImagePanel.qml @@ -96,6 +96,7 @@ Item { visible: root.state === d.dataImageState image.source: root.dataImage + image.cache: false showLoadingIndicator: true border.width: 1 border.color: Theme.palette.border diff --git a/ui/imports/shared/popups/ImportCommunityPopup.qml b/ui/imports/shared/popups/ImportCommunityPopup.qml index 24ba9e256a..dd7dee6794 100644 --- a/ui/imports/shared/popups/ImportCommunityPopup.qml +++ b/ui/imports/shared/popups/ImportCommunityPopup.qml @@ -174,6 +174,7 @@ StatusDialog { asset.name: visible ? d.communityDetails.image : "" asset.isImage: (asset.name !== "") asset.color: visible ? d.communityDetails.color : "" + asset.cache: false } Item { Layout.fillWidth: true } StatusBaseText { diff --git a/vendor/status-go b/vendor/status-go index d99fdf1b67..d6a8ef4695 160000 --- a/vendor/status-go +++ b/vendor/status-go @@ -1 +1 @@ -Subproject commit d99fdf1b672c2f8207371e7e2386a403196341b9 +Subproject commit d6a8ef4695329d081fbfeadb493fc6fb6c935edc