2019-04-21 15:20:20 -04:00
|
|
|
import QtQuick 2.7
|
2019-04-28 15:18:36 -04:00
|
|
|
import "../../Base"
|
2019-07-05 16:48:30 -04:00
|
|
|
import "../../utils.js" as Utils
|
2019-04-21 15:20:20 -04:00
|
|
|
|
|
|
|
Banner {
|
2019-07-05 16:48:30 -04:00
|
|
|
property string inviterId: ""
|
|
|
|
|
|
|
|
readonly property var inviterInfo:
|
|
|
|
inviterId ? users.getUser(inviterId) : null
|
2019-04-21 15:20:20 -04:00
|
|
|
|
2019-07-06 17:50:55 -04:00
|
|
|
color: theme.chat.inviteBanner.background
|
2019-04-28 11:01:38 -04:00
|
|
|
|
2019-07-07 00:24:23 -04:00
|
|
|
avatar.userId: inviterId
|
2019-04-21 15:20:20 -04:00
|
|
|
|
2019-07-05 16:48:30 -04:00
|
|
|
labelText: qsTr("%1 invited you to join the room.").arg(
|
|
|
|
inviterId ?
|
|
|
|
Utils.coloredNameHtml(inviterInfo.displayName, inviterId) :
|
|
|
|
qsTr("Someone")
|
|
|
|
)
|
2019-04-21 15:20:20 -04:00
|
|
|
|
|
|
|
buttonModel: [
|
|
|
|
{
|
2019-04-28 14:20:30 -04:00
|
|
|
name: "accept",
|
|
|
|
text: qsTr("Accept"),
|
2019-04-26 16:02:20 -04:00
|
|
|
iconName: "invite_accept",
|
2019-04-21 15:20:20 -04:00
|
|
|
},
|
|
|
|
{
|
2019-04-28 14:20:30 -04:00
|
|
|
name: "decline",
|
|
|
|
text: qsTr("Decline"),
|
2019-04-26 16:02:20 -04:00
|
|
|
iconName: "invite_decline",
|
2019-04-21 15:20:20 -04:00
|
|
|
}
|
|
|
|
]
|
2019-04-28 14:20:30 -04:00
|
|
|
|
|
|
|
buttonCallbacks: {
|
|
|
|
"accept": function(button) {
|
|
|
|
button.loading = true
|
2019-07-05 16:48:30 -04:00
|
|
|
py.callClientCoro(
|
|
|
|
chatPage.userId, "join", [chatPage.roomId], {},
|
|
|
|
function() { button.loading = false }
|
|
|
|
)
|
2019-04-28 14:20:30 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
"decline": function(button) {
|
|
|
|
button.loading = true
|
2019-07-05 16:48:30 -04:00
|
|
|
py.callClientCoro(
|
|
|
|
chatPage.userId, "room_leave", [chatPage.roomId], {},
|
|
|
|
function() { button.loading = false }
|
|
|
|
)
|
2019-04-28 14:20:30 -04:00
|
|
|
}
|
|
|
|
}
|
2019-04-21 15:20:20 -04:00
|
|
|
}
|