fix(CommunityPermissions): clean warnings by preventing assigning when some roles doesn't exist

Closes: #9608
This commit is contained in:
Michał Cieślak 2023-02-21 21:00:39 +01:00 committed by r4bbit
parent 1e7e2084a7
commit 34676d0ec7
4 changed files with 7 additions and 11 deletions

View File

@ -210,7 +210,7 @@ Rectangle {
asset.height: root.asset.height
asset.width: root.asset.width
asset.name: root.useLetterIdenticons ? model.text : model.imageSource
asset.name: root.useLetterIdenticons ? model.text : (model.imageSource ?? "")
asset.isImage: root.asset.isImage
asset.bgColor: root.asset.bgColor
asset.emoji: model.emoji ? model.emoji : ""

View File

@ -81,16 +81,13 @@ StatusListView {
width: ListView.view.width
key: model.key
name: model.name
shortName: !!model.shortName ? model.shortName : ""
iconSource: model.iconSource
shortName: model.shortName ?? ""
iconSource: model.iconSource ?? ""
subItems: model.subItems
selected: root.checkedKeys.includes(model.key)
onItemClicked: root.itemClicked(model.key,
model.name,
model.shortName,
model.iconSource,
model.subItems)
onItemClicked: root.itemClicked(
key, name, shortName, iconSource, subItems)
}
section.property: root.searchMode ? "" : "categoryLabel"

View File

@ -41,14 +41,14 @@ QtObject {
function getTokenShortNameByKey(model, key) {
const item = getTokenByKey(model, key)
if (item)
return item.shortName
return item.shortName ?? ""
return ""
}
function getTokenIconByKey(model, key) {
const item = getTokenByKey(model, key)
if (item)
return item.iconSource
return item.iconSource ?? ""
return ""
}

View File

@ -69,7 +69,6 @@ StatusScrollView {
sourceModel: model.channelsListModel
proxyRoles: [
ExpressionRole {
name: "imageSource"