fix(community): fix community images not updating without a force reset

Fixes #16688
This commit is contained in:
Jonathan Rainville 2024-11-04 13:24:48 -05:00
parent 27ececad63
commit 85dd85d56d
11 changed files with 30 additions and 3 deletions

View File

@ -327,11 +327,29 @@ QtObject:
self.items[ind].members.updateToTheseItems(item.members.getItems()) 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: if roles.len == 0:
return return
let dataIndex = self.createIndex(ind, 0, nil)
defer: dataIndex.delete
self.dataChanged(dataIndex, dataIndex, roles) self.dataChanged(dataIndex, dataIndex, roles)
proc updateMemberItemInSections*( proc updateMemberItemInSections*(

View File

@ -54,6 +54,7 @@ Loader {
width: parent.width width: parent.width
height: parent.height height: parent.height
image.source: root.asset.isImage ? root.asset.name : "" image.source: root.asset.isImage ? root.asset.name : ""
image.cache: root.asset.cache
showLoadingIndicator: true showLoadingIndicator: true
border.width: root.asset.imgIsIdenticon ? 1 : 0 border.width: root.asset.imgIsIdenticon ? 1 : 0
border.color: Theme.palette.directColor7 border.color: Theme.palette.directColor7

View File

@ -40,6 +40,7 @@ QtObject {
property bool isImage: isImgSrc(root.name) property bool isImage: isImgSrc(root.name)
property int imgStatus property int imgStatus
property bool imgIsIdenticon: false property bool imgIsIdenticon: false
property bool cache: true
// ring settings hints // ring settings hints
readonly property real ringPxSize: Math.max(1.5, root.width / 24.0) readonly property real ringPxSize: Math.max(1.5, root.width / 24.0)

View File

@ -290,6 +290,7 @@ Item {
asset.name: assetName asset.name: assetName
asset.isImage: chatContentModule && chatContentModule.chatDetails.icon !== "" asset.isImage: chatContentModule && chatContentModule.chatDetails.icon !== ""
asset.isLetterIdenticon: chatContentModule && chatContentModule.chatDetails.icon === "" asset.isLetterIdenticon: chatContentModule && chatContentModule.chatDetails.icon === ""
asset.cache: false
ringSettings.ringSpecModel: chatContentModule && chatContentModule.chatDetails.type === Constants.chatType.oneToOne ? ringSettings.ringSpecModel: chatContentModule && chatContentModule.chatDetails.type === Constants.chatType.oneToOne ?
Utils.getColorHashAsJson(chatContentModule.chatDetails.id) : "" Utils.getColorHashAsJson(chatContentModule.chatDetails.id) : ""
asset.color: chatContentModule? asset.color: chatContentModule?

View File

@ -34,6 +34,7 @@ Control {
asset.name: root.image asset.name: root.image
asset.color: root.color asset.color: root.color
asset.isImage: true asset.isImage: true
asset.cache: false
type: StatusChatInfoButton.Type.OneToOneChat type: StatusChatInfoButton.Type.OneToOneChat
hoverEnabled: root.amISectionAdmin hoverEnabled: root.amISectionAdmin
onClicked: if(root.amISectionAdmin) root.infoButtonClicked() onClicked: if(root.amISectionAdmin) root.infoButtonClicked()

View File

@ -30,6 +30,7 @@ RowLayout {
title: root.joinCommunity ? root.name : root.channelName title: root.joinCommunity ? root.name : root.channelName
subTitle: root.joinCommunity ? root.communityDesc : root.channelDesc subTitle: root.joinCommunity ? root.communityDesc : root.channelDesc
asset.color: root.color asset.color: root.color
asset.cache: false
enabled: false enabled: false
type: StatusChatInfoButton.Type.CommunityChat type: StatusChatInfoButton.Type.CommunityChat
layer.enabled: root.joinCommunity // Blured when joining community but not when entering channel layer.enabled: root.joinCommunity // Blured when joining community but not when entering channel

View File

@ -118,6 +118,7 @@ StatusSectionLayout {
asset.name: community.image asset.name: community.image
asset.color: community.color asset.color: community.color
asset.isImage: true asset.isImage: true
asset.cache: false
Layout.fillWidth: true Layout.fillWidth: true
Layout.leftMargin: Theme.halfPadding Layout.leftMargin: Theme.halfPadding
Layout.rightMargin: Theme.halfPadding Layout.rightMargin: Theme.halfPadding

View File

@ -704,6 +704,7 @@ Item {
icon.name: model.icon icon.name: model.icon
icon.source: model.image icon.source: model.image
identicon.asset.color: (hovered || identicon.highlighted || checked) ? model.color : icon.color identicon.asset.color: (hovered || identicon.highlighted || checked) ? model.color : icon.color
identicon.asset.cache: false
tooltip.text: model.name tooltip.text: model.name
checked: model.active checked: model.active
badge.value: model.notificationsCount badge.value: model.notificationsCount

View File

@ -96,6 +96,7 @@ Item {
visible: root.state === d.dataImageState visible: root.state === d.dataImageState
image.source: root.dataImage image.source: root.dataImage
image.cache: false
showLoadingIndicator: true showLoadingIndicator: true
border.width: 1 border.width: 1
border.color: Theme.palette.border border.color: Theme.palette.border

View File

@ -174,6 +174,7 @@ StatusDialog {
asset.name: visible ? d.communityDetails.image : "" asset.name: visible ? d.communityDetails.image : ""
asset.isImage: (asset.name !== "") asset.isImage: (asset.name !== "")
asset.color: visible ? d.communityDetails.color : "" asset.color: visible ? d.communityDetails.color : ""
asset.cache: false
} }
Item { Layout.fillWidth: true } Item { Layout.fillWidth: true }
StatusBaseText { StatusBaseText {

2
vendor/status-go vendored

@ -1 +1 @@
Subproject commit d99fdf1b672c2f8207371e7e2386a403196341b9 Subproject commit d6a8ef4695329d081fbfeadb493fc6fb6c935edc