Show LeftBanner with a generic left text

This commit is contained in:
miruka
2019-07-06 23:43:51 -04:00
parent 3ff0e1bd70
commit 03d9079d63
8 changed files with 42 additions and 33 deletions

View File

@@ -10,7 +10,8 @@ Banner {
color: theme.chat.inviteBanner.background
avatar.name: inviterId ? inviterInfo.displayName : ""
avatar.name: inviterId ? (inviterInfo.displayName ||
Utils.stripUserId(inviterId)) : ""
avatar.imageUrl: inviterId ? inviterInfo.avatarUrl : ""
labelText: qsTr("%1 invited you to join the room.").arg(

View File

@@ -1,14 +1,17 @@
import QtQuick 2.7
import "../../Base"
import "../utils.js" as ChatJS
import "../../utils.js" as Utils
Banner {
property var leftEvent: null
property string userId: ""
readonly property var userInfo: users.getUser(userId)
color: theme.chat.leftBanner.background
avatar.name: ChatJS.getLeftBannerAvatarName(leftEvent, chatPage.userId)
labelText: ChatJS.getLeftBannerText(leftEvent)
// TODO: avatar func auto
avatar.name: userInfo.displayName || Utils.stripUserId(userId)
avatar.imageUrl: users.getUser(userId).avatarUrl
labelText: qsTr("You are not part of this room anymore.")
buttonModel: [
{
@@ -21,8 +24,13 @@ Banner {
buttonCallbacks: {
"forget": function(button) {
button.loading = true
Backend.clients.get(chatPage.userId).forgetRoom(chatPage.roomId)
pageStack.clear()
py.callClientCoro(
chatPage.userId, "room_forget", [chatPage.roomId], {},
function() {
button.loading = false
pageStack.clear()
}
)
},
}
}

View File

@@ -14,8 +14,8 @@ HColumnLayout {
{"userId": userId, "roomId": roomId, "category": category}, 1
)[0]
readonly property var sender:
users.getWhere({"userId": userId}, 1)[0]
readonly property var sender: //TODO: info$
users.getUser(userId)
readonly property bool hasUnknownDevices: false
//category == "Rooms" ?
@@ -73,10 +73,10 @@ HColumnLayout {
visible: category == "Rooms" && ! hasUnknownDevices
}
//LeftBanner {
//visible: category == "Left"
//leftEvent: roomInfo.leftEvent
//}
LeftBanner {
visible: category == "Left"
userId: chatPage.userId
}
}
// RoomSidePane {