fix(@desktop/chat): adjust add members default picture
Update colorForPubkey to check if colorId is in bounds Replace userCustomizationColors array usage with Utils function call Fixes #6971
This commit is contained in:
parent
10f34d0610
commit
38c77095b8
|
@ -4,6 +4,7 @@ import QtQuick.Controls 2.3
|
|||
import StatusQ.Core 0.1
|
||||
import StatusQ.Components 0.1
|
||||
import StatusQ.Controls 0.1
|
||||
import StatusQ.Core.Theme 0.1
|
||||
|
||||
import utils 1.0
|
||||
|
||||
|
@ -34,7 +35,14 @@ StatusListView {
|
|||
|
||||
title: !model.displayName.endsWith(".eth") && !!model.localNickname ?
|
||||
model.localNickname : Utils.removeStatusEns(model.displayName)
|
||||
image.source: Global.getProfileImage(model.pubKey)
|
||||
image.source: model.icon
|
||||
icon: StatusIconSettings {
|
||||
color: Utils.colorForPubkey(model.pubKey)
|
||||
charactersLen: 2
|
||||
isLetterIdenticon: model.icon === ""
|
||||
height: isLetterIdenticon ? 40 : 20
|
||||
width: isLetterIdenticon ? 40 : 20
|
||||
}
|
||||
ringSettings.ringSpecModel: Utils.getColorHashAsJson(model.pubKey)
|
||||
|
||||
height: visible ? implicitHeight : 0
|
||||
|
|
|
@ -95,7 +95,7 @@ Item {
|
|||
image.isIdenticon: false
|
||||
|
||||
status: model.onlineStatus
|
||||
icon.color: Theme.palette.userCustomizationColors[Utils.colorIdForPubkey(model.pubKey)] // FIXME: use model.colorId
|
||||
icon.color: Utils.colorForPubkey(model.pubKey) // FIXME: use model.colorId
|
||||
ringSettings.ringSpecModel: Utils.getColorHashAsJson(model.pubKey) // FIXME: use model.colorHash
|
||||
onClicked: {
|
||||
if (mouse.button === Qt.RightButton) {
|
||||
|
|
|
@ -140,7 +140,7 @@ Item {
|
|||
nickName: model.localNickname
|
||||
userName: model.displayName
|
||||
status: model.onlineStatus
|
||||
icon.color: Theme.palette.userCustomizationColors[Utils.colorIdForPubkey(model.pubKey)] // FIXME: use model.colorId
|
||||
icon.color: Utils.colorForPubkey(model.pubKey) // FIXME: use model.colorId
|
||||
image.source: model.icon
|
||||
image.isIdenticon: false
|
||||
image.width: 40
|
||||
|
|
|
@ -208,7 +208,7 @@ StatusModal {
|
|||
image.source: model.icon
|
||||
ringSettings.ringSpecModel: Utils.getColorHashAsJson(model.pubKey)
|
||||
icon: StatusIconSettings {
|
||||
color: Theme.palette.userCustomizationColors[Utils.colorIdForPubkey(model.pubKey)]
|
||||
color: Utils.colorForPubkey(model.pubKey)
|
||||
charactersLen: 2
|
||||
isLetterIdenticon: model.icon === ""
|
||||
height: isLetterIdenticon ? 40 : 20
|
||||
|
|
|
@ -38,7 +38,7 @@ StatusModal {
|
|||
// root.item.color
|
||||
// until then the following is used
|
||||
background.color: root.item.type === Constants.settingsSection.exemptions.oneToOneChat?
|
||||
Theme.palette.userCustomizationColors[Utils.colorIdForPubkey(root.item.itemId)] :
|
||||
Utils.colorForPubkey(root.item.itemId) :
|
||||
root.item.color
|
||||
charactersLen: root.item.type === Constants.settingsSection.exemptions.oneToOneChat? 2 : 1
|
||||
isLetterIdenticon: root.item.image === ""
|
||||
|
|
|
@ -123,7 +123,7 @@ SettingsContentBase {
|
|||
ringSettings.ringSpecModel: model.type === Constants.settingsSection.exemptions.oneToOneChat ? Utils.getColorHashAsJson(model.itemId) : undefined
|
||||
icon: StatusIconSettings {
|
||||
color: model.type === Constants.settingsSection.exemptions.oneToOneChat?
|
||||
Theme.palette.userCustomizationColors[Utils.colorIdForPubkey(model.itemId)] :
|
||||
Utils.colorForPubkey(model.itemId) :
|
||||
model.color
|
||||
charactersLen: model.type === Constants.settingsSection.exemptions.oneToOneChat? 2 : 1
|
||||
isLetterIdenticon: model.image === ""
|
||||
|
|
|
@ -577,7 +577,14 @@ QtObject {
|
|||
}
|
||||
|
||||
function colorForPubkey(publicKey) {
|
||||
return Theme.palette.userCustomizationColors[colorIdForPubkey(publicKey)]
|
||||
const pubKeyColorId = colorIdForPubkey(publicKey)
|
||||
|
||||
if (pubKeyColorId < 0 || pubKeyColorId >= Theme.palette.userCustomizationColors.length) {
|
||||
console.warn("Utils.colorForPubkey : colorId for publicKey is out of bounds")
|
||||
return StatusColors.colors['blue']
|
||||
}
|
||||
|
||||
return Theme.palette.userCustomizationColors[pubKeyColorId]
|
||||
}
|
||||
|
||||
function getCompressedPk(publicKey) {
|
||||
|
|
Loading…
Reference in New Issue