moment/src/qml/Chat/Banners/InviteBanner.qml

53 lines
1.4 KiB
QML
Raw Normal View History

import QtQuick 2.12
import "../../Base"
import "../../utils.js" as Utils
Banner {
property string inviterId: chatPage.roomInfo.inviter
property string inviterName: chatPage.roomInfo.inviter_name
property string inviterAvatar: chatPage.roomInfo.inviter_avatar
color: theme.chat.inviteBanner.background
2019-04-28 11:01:38 -04:00
avatar.userId: inviterId
avatar.displayName: inviterName
avatar.mxc: inviterAvatar
labelText: qsTr("%1 invited you to this room").arg(
Utils.coloredNameHtml(inviterName, inviterId)
)
buttonModel: [
{
name: "accept",
text: qsTr("Join"),
2019-07-18 04:23:23 -04:00
iconName: "invite-accept",
2019-08-28 18:21:13 -04:00
iconColor: theme.colors.positiveBackground
},
{
name: "decline",
text: qsTr("Decline"),
2019-07-18 04:23:23 -04:00
iconName: "invite-decline",
2019-08-28 18:21:13 -04:00
iconColor: theme.colors.negativeBackground
}
]
buttonCallbacks: ({
accept: button => {
button.loading = true
py.callClientCoro(
chatPage.userId, "join", [chatPage.roomId], () => {
button.loading = false
})
},
decline: button => {
button.loading = true
py.callClientCoro(
chatPage.userId, "room_leave", [chatPage.roomId], () => {
button.loading = false
})
}
})
}