Chat InviteBanner: make decline button spawn popup

Rather than leaving the room as soon as the button is clicked.
This offers the option of also forgetting that room, and will allow
checking a future "ignore inviter" too.
This commit is contained in:
miruka 2021-04-13 15:54:43 -04:00
parent 70ae16a7c1
commit 3683d7db20
2 changed files with 15 additions and 6 deletions

View File

@ -5,6 +5,8 @@ import QtQuick 2.12
import "../../../Base"
Banner {
id: root
property string inviterId: chat.roomInfo.inviter
property string inviterName: chat.roomInfo.inviter_name
property string inviterAvatar: chat.roomInfo.inviter_avatar
@ -44,11 +46,17 @@ Banner {
},
decline: button => {
button.loading = true
py.callClientCoro(
chat.userId, "room_leave", [chat.roomId], () => {
button.loading = false
})
window.makePopup(
"Popups/LeaveRoomPopup.qml",
{
userId: chat.userId,
roomId: chat.roomId,
roomName: chat.roomInfo.display_name,
inviterId: root.inviterId,
left: chat.roomInfo.left,
leftCallback: () => { button.loading = true },
},
)
}
})
}

View File

@ -14,6 +14,7 @@ HFlickableColumnPopup {
property string roomName: ""
property string inviterId: ""
property bool left: false
property var leftCallback: null
function forget() {
py.callClientCoro(userId, "room_forget", [roomId], () => {
@ -30,7 +31,7 @@ HFlickableColumnPopup {
}
function leave() {
py.callClientCoro(userId, "room_leave", [roomId])
py.callClientCoro(userId, "room_leave", [roomId], leftCallback)
popup.close()
}