From 3683d7db20ac1726d8d5337f68130978819fb61a Mon Sep 17 00:00:00 2001 From: miruka Date: Tue, 13 Apr 2021 15:54:43 -0400 Subject: [PATCH] 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. --- src/gui/Pages/Chat/Banners/InviteBanner.qml | 18 +++++++++++++----- src/gui/Popups/LeaveRoomPopup.qml | 3 ++- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/gui/Pages/Chat/Banners/InviteBanner.qml b/src/gui/Pages/Chat/Banners/InviteBanner.qml index 411091b8..830ab35c 100644 --- a/src/gui/Pages/Chat/Banners/InviteBanner.qml +++ b/src/gui/Pages/Chat/Banners/InviteBanner.qml @@ -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 }, + }, + ) } }) } diff --git a/src/gui/Popups/LeaveRoomPopup.qml b/src/gui/Popups/LeaveRoomPopup.qml index 07df78e3..7aab359a 100644 --- a/src/gui/Popups/LeaveRoomPopup.qml +++ b/src/gui/Popups/LeaveRoomPopup.qml @@ -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() }