fix(@desktop/chat): Fix for Leave chat is shown instead of Delete confirmation when deleting community channel

fixes #3365
This commit is contained in:
Khushboo Mehta 2021-09-14 11:58:20 +02:00 committed by Iuri Matias
parent aa8060221c
commit 2448b710b4
3 changed files with 19 additions and 14 deletions

View File

@ -218,7 +218,7 @@ Item {
onNotificationButtonClicked: activityCenter.open()
popupMenu: ChatContextMenu {
openHandler: {
onOpened: {
chatItem = chatsModel.channelView.activeChannel
}
}

View File

@ -136,16 +136,7 @@ StatusPopupMenu {
type: StatusMenuItem.Type.Danger
onTriggered: {
let label = chatItem && chatItem.chatType === Constants.chatTypeOneToOne ?
//% "Delete chat"
qsTrId("delete-chat") :
//% "Leave chat"
qsTrId("leave-chat")
openPopup(deleteChatConfirmationDialogComponent, {
title: label,
confirmButtonLabel: label,
chatId: chatItem.id
})
openPopup(deleteChatConfirmationDialogComponent)
}
enabled: !communityActive || chatsModel.communities.activeCommunity.admin
@ -166,13 +157,27 @@ StatusPopupMenu {
Component {
id: deleteChatConfirmationDialogComponent
ConfirmationDialog {
property string chatId
property string chatId: chatItem.id
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?")
showCancelButton: communityActive
onClosed: {
destroy()
}
onCancelButtonClicked: {
close()
}
onConfirmButtonClicked: {
if (communityActive) {
chatsModel.communities.deleteCommunityChat(chatsModel.communities.activeCommunity.id, chatId)

View File

@ -23,7 +23,7 @@ StatusModal {
property alias checkbox: checkbox
header.title: qsTr("Confirm you action")
header.title: qsTr("Confirm your action")
focus: visible
signal confirmButtonClicked()