Remove forgotten rooms from the view
This commit is contained in:
parent
47327c64cf
commit
b02fc11903
4
TODO.md
4
TODO.md
|
@ -1,3 +1,6 @@
|
|||
- room doesn't change category when accept/reject invite
|
||||
- forget doesn't delete
|
||||
|
||||
- "rejoin" leftbanner button if room is public
|
||||
- daybreak color
|
||||
- html links color
|
||||
|
@ -14,6 +17,7 @@ sticky avatar at top
|
|||
ability to cancel message being sent
|
||||
|
||||
nio
|
||||
set typing
|
||||
fix `RoomForgetResponse.create_error`
|
||||
|
||||
OLD
|
||||
|
|
|
@ -60,9 +60,8 @@ class RoomUpdated(Event):
|
|||
|
||||
|
||||
@dataclass
|
||||
class RoomDeleted(Event):
|
||||
class RoomForgotten(Event):
|
||||
user_id: str = field()
|
||||
category: str = field()
|
||||
room_id: str = field()
|
||||
|
||||
|
||||
|
|
|
@ -188,6 +188,11 @@ class MatrixClient(nio.AsyncClient):
|
|||
return more_to_load
|
||||
|
||||
|
||||
async def room_forget(self, room_id: str) -> None:
|
||||
await super().room_forget(room_id)
|
||||
rooms.RoomForgotten(user_id=self.user_id, room_id=room_id)
|
||||
|
||||
|
||||
# Callbacks for nio responses
|
||||
|
||||
async def onSyncResponse(self, resp: nio.SyncResponse) -> None:
|
||||
|
|
|
@ -3,8 +3,10 @@ import QtQuick 2.7
|
|||
HAvatar {
|
||||
property string roomId: ""
|
||||
|
||||
// roomInfo ? → Avoid error messages when a room is forgotten
|
||||
readonly property var roomInfo: rooms.getWhere({"roomId": roomId}, 1)[0]
|
||||
readonly property var dname: roomInfo.displayName
|
||||
readonly property var dname: roomInfo ? roomInfo.displayName : ""
|
||||
|
||||
name: dname[0] == "#" && dname.length > 1 ? dname.substring(1) : dname
|
||||
imageUrl: roomInfo.avatarUrl
|
||||
imageUrl: roomInfo ? roomInfo.avatarUrl : null
|
||||
}
|
||||
|
|
|
@ -25,11 +25,8 @@ Banner {
|
|||
button.loading = true
|
||||
py.callClientCoro(
|
||||
chatPage.userId, "room_forget", [chatPage.roomId], {},
|
||||
function() {
|
||||
button.loading = false
|
||||
pageStack.clear()
|
||||
}
|
||||
function() { button.loading = false }
|
||||
)
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import "RoomSidePane"
|
|||
|
||||
HColumnLayout {
|
||||
property var roomInfo: null
|
||||
onRoomInfoChanged: if (! roomInfo) { pageStack.showPage("Default") }
|
||||
|
||||
readonly property string userId: roomInfo.userId
|
||||
readonly property string category: roomInfo.category
|
||||
|
|
|
@ -79,9 +79,8 @@ function onRoomUpdated(
|
|||
}
|
||||
|
||||
|
||||
function onRoomDeleted(user_id, category, room_id) {
|
||||
var roles = {"userId": user_id, "roomId": room_id, "category": category}
|
||||
rooms.popWhere(roles, 1)
|
||||
function onRoomForgotten(user_id, room_id) {
|
||||
rooms.popWhere({"userId": user_id, "roomId": room_id})
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,11 +1,4 @@
|
|||
import QtQuick 2.7
|
||||
import SortFilterProxyModel 0.2
|
||||
import "../Base"
|
||||
|
||||
HListModel {
|
||||
sorters: FilterSorter {
|
||||
ValueFilter { roleName: "name"; value: "Invites" }
|
||||
ValueFilter { roleName: "name"; value: "Rooms" }
|
||||
ValueFilter { roleName: "name"; value: "Left" }
|
||||
}
|
||||
}
|
||||
HListModel {}
|
||||
|
|
|
@ -14,6 +14,12 @@ HListView {
|
|||
roleName: "userId"
|
||||
value: userId
|
||||
}
|
||||
|
||||
sorters: FilterSorter {
|
||||
ValueFilter { roleName: "name"; value: "Invites" }
|
||||
ValueFilter { roleName: "name"; value: "Rooms" }
|
||||
ValueFilter { roleName: "name"; value: "Left" }
|
||||
}
|
||||
}
|
||||
|
||||
delegate: RoomCategoryDelegate {}
|
||||
|
|
Loading…
Reference in New Issue
Block a user