fix: ensure communityDetails are updated in PermissionsView (#14981)

Fixed an issue where communityDetails were not being updated in PermissionsView.
This issue was causing the name, color, and image not to update correctly.

Co-authored-by: mdias <maildomarcio@gmail.com>
This commit is contained in:
Jonathan Rainville 2024-05-30 09:52:28 -04:00 committed by GitHub
parent 9f67616b63
commit 42b10783ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 25 additions and 9 deletions

View File

@ -31,7 +31,7 @@ ColumnLayout {
required property var channelsModel
// id, name, image, color, owner, admin properties expected
required property var communityDetails
required property QtObject communityDetails
property int viewWidth: 560 // by design
property bool viewOnlyCanAddReaction
@ -44,16 +44,32 @@ ColumnLayout {
signal userRestrictionsToggled(bool checked)
readonly property alias count: repeater.count
Connections {
target: root.communityDetails
function onNameChanged(){
resetCommunityItemModel()
}
function onImageChanged(){
resetCommunityItemModel()
}
function onColorChanged(){
resetCommunityItemModel()
}
}
function resetCommunityItemModel(){
communityItemModel.clear()
communityItemModel.append({
text: root.communityDetails.name,
imageSource: root.communityDetails.image,
color: root.communityDetails.color
})
}
ListModel {
id: communityItemModel
Component.onCompleted: {
append({
text: root.communityDetails.name,
imageSource: root.communityDetails.image,
color: root.communityDetails.color
})
}
Component.onCompleted: resetCommunityItemModel()
}
IntroPanel {