LeaveRoomPopup: new text for declining invites

This commit is contained in:
miruka 2021-04-13 14:44:24 -04:00
parent 334065895f
commit 96a1e57f47
3 changed files with 17 additions and 5 deletions

View File

@ -238,6 +238,7 @@ HTile {
userId: model.for_account,
roomId: model.id,
roomName: model.display_name,
inviterId: model.inviter_id,
})
}

View File

@ -54,7 +54,12 @@ Item {
active: userInfo && userInfo.presence !== "offline"
onActivated: window.makePopup(
"Popups/LeaveRoomPopup.qml",
{userId, roomId, roomName: roomInfo.display_name},
{
userId,
roomId,
roomName: roomInfo.display_name,
inviterId: roomInfo.inviter_id,
},
)
}

View File

@ -11,13 +11,14 @@ HFlickableColumnPopup {
property string userId: ""
property string roomId: ""
property string roomName: ""
property string inviterId: ""
property var leftCallback: null
page.footer: AutoDirectionLayout {
ApplyButton {
id: leaveButton
icon.name: "room-leave"
text: qsTr("Leave")
text: inviterId ? qsTr("Decline") : qsTr("Leave")
onClicked: {
py.callClientCoro(userId, "room_leave", [roomId], leftCallback)
@ -33,13 +34,18 @@ HFlickableColumnPopup {
onOpened: leaveButton.forceActiveFocus()
SummaryLabel {
text: qsTr("Leave %1?").arg(
utils.htmlColorize(roomName, theme.colors.accentText),
)
readonly property string roomText:
utils.htmlColorize(roomName, theme.colors.accentText)
textFormat: Text.StyledText
text:
inviterId ?
qsTr("Decline invite to %1?").arg(roomText) :
qsTr("Leave %1?").arg(roomText)
}
DetailsLabel {
visible: inviterId === ""
text: qsTr(
"If this room is private, you will not be able to rejoin it."
)