fix(StatusChatInfoButton): missing lock icon

- propagate and set `requiresPermissions` + `locked` from the
`chatContentModule.chatDetails`
- set the icon accordingly for community chats

Fixes #16502
This commit is contained in:
Lukáš Tinkl 2024-10-10 16:48:26 +02:00 committed by Lukáš Tinkl
parent 0bb2bc0e03
commit 6ba74fae8e
2 changed files with 10 additions and 4 deletions

View File

@ -15,7 +15,8 @@ Button {
property string subTitle property string subTitle
property bool muted property bool muted
property int pinnedMessagesCount property int pinnedMessagesCount
property bool requiresPermissions
property bool locked
property bool forceHideTypeIcon: false property bool forceHideTypeIcon: false
property StatusAssetSettings asset: StatusAssetSettings { property StatusAssetSettings asset: StatusAssetSettings {
@ -108,8 +109,12 @@ Button {
return "tiny/public-chat" return "tiny/public-chat"
case StatusChatInfoButton.Type.GroupChat: case StatusChatInfoButton.Type.GroupChat:
return "tiny/group" return "tiny/group"
case StatusChatInfoButton.Type.CommunityChat: case StatusChatInfoButton.Type.CommunityChat: {
return "tiny/channel" var iconName = "tiny/channel"
if (root.requiresPermissions)
iconName = root.locked ? "tiny/channel-locked" : "tiny/channel-unlocked"
return Theme.palette.name === "light" ? iconName : iconName+"-white"
}
default: default:
return "" return ""
} }

View File

@ -270,7 +270,8 @@ Item {
objectName: "chatInfoBtnInHeader" objectName: "chatInfoBtnInHeader"
title: chatContentModule? chatContentModule.chatDetails.name : "" title: chatContentModule? chatContentModule.chatDetails.name : ""
requiresPermissions: chatContentModule ? chatContentModule.chatDetails.requiresPermissions : false
locked: requiresPermissions && (chatContentModule ? !chatContentModule.chatDetails.canPost : false)
subTitle: { subTitle: {
if(!chatContentModule) if(!chatContentModule)
return "" return ""