Update LeftBanner, fix forget button crash

This commit is contained in:
miruka 2019-08-15 13:00:15 -04:00
parent 3270c6dd19
commit 6a7376d498
4 changed files with 11 additions and 12 deletions

View File

@ -258,8 +258,8 @@ class MatrixClient(nio.AsyncClient):
async def room_forget(self, room_id: str) -> None:
await super().room_forget(room_id)
self.models[Room, self.user_id].pop(room_id, None)
self.models.pop([Event, self.user_id, room_id], None)
self.models.pop([Member, room_id], None)
self.models.pop((Event, self.user_id, room_id), None)
self.models.pop((Member, room_id), None)
async def upload_file(self, path: Union[Path, str]) -> str:
@ -335,7 +335,6 @@ class MatrixClient(nio.AsyncClient):
inviter = getattr(room, "inviter", "") or ""
self.models[Room, self.user_id][room.room_id] = Room(
room_id = room.room_id,
display_name = name,

View File

@ -2,12 +2,12 @@ import QtQuick 2.12
import "../../Base"
Banner {
property string userId: ""
color: theme.chat.leftBanner.background
// TODO: avatar func auto
avatar.userId: userId
avatar.userId: chatPage.userId
avatar.displayName: chatPage.userInfo.display_name
avatar.avatarUrl: chatPage.userInfo.avatar_url
labelText: qsTr("You are not part of this room anymore.")
buttonModel: [

View File

@ -9,7 +9,11 @@ HPage {
property string userId: ""
property string roomId: ""
property bool ready: roomInfo !== "waiting"
property bool ready: userInfo !== "waiting" && roomInfo !== "waiting"
readonly property var userInfo:
Utils.getItem(modelSources["Account"] || [], "user_id", userId) ||
"waiting"
readonly property var roomInfo: Utils.getItem(
modelSources[["Room", userId]] || [], "room_id", roomId

View File

@ -15,7 +15,6 @@ HSplitView {
EventList {
// Avoid a certain binding loop
Layout.minimumWidth: theme.minimumSupportedWidth
Layout.fillWidth: true
Layout.fillHeight: true
}
@ -26,9 +25,8 @@ HSplitView {
InviteBanner {
id: inviteBanner
visible: Boolean(inviterId)
visible: ! chatPage.roomInfo.left && inviterId
inviterId: chatPage.roomInfo.inviter_id
Layout.fillWidth: true
}
@ -40,8 +38,6 @@ HSplitView {
LeftBanner {
id: leftBanner
visible: chatPage.roomInfo.left
userId: chatPage.userId
Layout.fillWidth: true
}
}