fix(@desktop/chat): Fix for Leave chat is shown instead of Delete confirmation when deleting community channel
fixes #3365
This commit is contained in:
parent
aa8060221c
commit
2448b710b4
|
@ -218,7 +218,7 @@ Item {
|
||||||
onNotificationButtonClicked: activityCenter.open()
|
onNotificationButtonClicked: activityCenter.open()
|
||||||
|
|
||||||
popupMenu: ChatContextMenu {
|
popupMenu: ChatContextMenu {
|
||||||
openHandler: {
|
onOpened: {
|
||||||
chatItem = chatsModel.channelView.activeChannel
|
chatItem = chatsModel.channelView.activeChannel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,16 +136,7 @@ StatusPopupMenu {
|
||||||
|
|
||||||
type: StatusMenuItem.Type.Danger
|
type: StatusMenuItem.Type.Danger
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
let label = chatItem && chatItem.chatType === Constants.chatTypeOneToOne ?
|
openPopup(deleteChatConfirmationDialogComponent)
|
||||||
//% "Delete chat"
|
|
||||||
qsTrId("delete-chat") :
|
|
||||||
//% "Leave chat"
|
|
||||||
qsTrId("leave-chat")
|
|
||||||
openPopup(deleteChatConfirmationDialogComponent, {
|
|
||||||
title: label,
|
|
||||||
confirmButtonLabel: label,
|
|
||||||
chatId: chatItem.id
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enabled: !communityActive || chatsModel.communities.activeCommunity.admin
|
enabled: !communityActive || chatsModel.communities.activeCommunity.admin
|
||||||
|
@ -166,13 +157,27 @@ StatusPopupMenu {
|
||||||
Component {
|
Component {
|
||||||
id: deleteChatConfirmationDialogComponent
|
id: deleteChatConfirmationDialogComponent
|
||||||
ConfirmationDialog {
|
ConfirmationDialog {
|
||||||
property string chatId
|
property string chatId: chatItem.id
|
||||||
btnType: "warn"
|
btnType: "warn"
|
||||||
confirmationText: communityActive ? qsTr("Are you sure you want to delete this channel?") :
|
header.title: communityActive ? qsTr("Delete #%1").arg(chatItem.name) :
|
||||||
|
chatItem && chatItem.chatType === Constants.chatTypeOneToOne ?
|
||||||
|
//% "Delete chat"
|
||||||
|
qsTrId("delete-chat") :
|
||||||
|
//% "Leave chat"
|
||||||
|
qsTrId("leave-chat")
|
||||||
|
confirmButtonLabel: communityActive ? qsTr("Delete") : header.title
|
||||||
|
confirmationText: communityActive ? qsTr("Are you sure you want to delete #%1 channel?").arg(chatItem.name) :
|
||||||
|
chatItem && chatItem.chatType === Constants.chatTypeOneToOne ?
|
||||||
|
qsTr("Are you sure you want to delete this chat?"):
|
||||||
qsTr("Are you sure you want to leave this chat?")
|
qsTr("Are you sure you want to leave this chat?")
|
||||||
|
showCancelButton: communityActive
|
||||||
|
|
||||||
onClosed: {
|
onClosed: {
|
||||||
destroy()
|
destroy()
|
||||||
}
|
}
|
||||||
|
onCancelButtonClicked: {
|
||||||
|
close()
|
||||||
|
}
|
||||||
onConfirmButtonClicked: {
|
onConfirmButtonClicked: {
|
||||||
if (communityActive) {
|
if (communityActive) {
|
||||||
chatsModel.communities.deleteCommunityChat(chatsModel.communities.activeCommunity.id, chatId)
|
chatsModel.communities.deleteCommunityChat(chatsModel.communities.activeCommunity.id, chatId)
|
||||||
|
|
|
@ -23,7 +23,7 @@ StatusModal {
|
||||||
property alias checkbox: checkbox
|
property alias checkbox: checkbox
|
||||||
|
|
||||||
|
|
||||||
header.title: qsTr("Confirm you action")
|
header.title: qsTr("Confirm your action")
|
||||||
focus: visible
|
focus: visible
|
||||||
|
|
||||||
signal confirmButtonClicked()
|
signal confirmButtonClicked()
|
||||||
|
|
Loading…
Reference in New Issue