Add verified devices indicator to room header
This commit is contained in:
parent
90a7a3a6cf
commit
0a2d274824
2
TODO.md
2
TODO.md
|
@ -1,7 +1,6 @@
|
|||
# TODO
|
||||
|
||||
- issue templates
|
||||
- ctrl-tab highlight
|
||||
|
||||
## Refactoring
|
||||
|
||||
|
@ -11,6 +10,7 @@
|
|||
|
||||
## Issues
|
||||
|
||||
- Signing out leaves the account's rooms in the list
|
||||
- Need to unregister popups/menus when they are destroyed without being closed
|
||||
|
||||
- Bottom focus line for an `HTextArea` inside a `ScrollView` is invisible,
|
||||
|
|
|
@ -1412,6 +1412,11 @@ class MatrixClient(nio.AsyncClient):
|
|||
local_unreads = False
|
||||
local_highlights = False
|
||||
update_account_unread_counts = True
|
||||
unverified_devices = (
|
||||
False
|
||||
if isinstance(room, nio.MatrixInvitedRoom) else
|
||||
self.room_contains_unverified(room.room_id)
|
||||
)
|
||||
else:
|
||||
last_event_date = registered.last_event_date
|
||||
typing_members = registered.typing_members
|
||||
|
@ -1421,6 +1426,7 @@ class MatrixClient(nio.AsyncClient):
|
|||
registered.unreads != room.unread_notifications or
|
||||
registered.highlights != room.unread_highlights
|
||||
)
|
||||
unverified_devices = registered.unverified_devices
|
||||
|
||||
room_item = Room(
|
||||
id = room.room_id,
|
||||
|
@ -1443,6 +1449,7 @@ class MatrixClient(nio.AsyncClient):
|
|||
typing_members = typing_members,
|
||||
|
||||
encrypted = room.encrypted,
|
||||
unverified_devices = unverified_devices,
|
||||
invite_required = room.join_rule == "invite",
|
||||
guests_allowed = room.guest_access == "can_join",
|
||||
|
||||
|
|
|
@ -70,6 +70,7 @@ class Room(ModelItem):
|
|||
|
||||
federated: bool = True
|
||||
encrypted: bool = False
|
||||
unverified_devices: bool = False
|
||||
invite_required: bool = True
|
||||
guests_allowed: bool = True
|
||||
|
||||
|
|
|
@ -105,6 +105,25 @@ class NioCallbacks:
|
|||
account.first_sync_done = True
|
||||
|
||||
|
||||
async def onKeysQueryResponse(self, resp: nio.KeysQueryResponse) -> None:
|
||||
refresh_rooms = {}
|
||||
|
||||
for user_id in resp.changed:
|
||||
for room in self.client.rooms.values():
|
||||
if user_id in room.users:
|
||||
refresh_rooms[room.room_id] = room
|
||||
|
||||
for room_id, room in refresh_rooms.items():
|
||||
room_item = self.models[self.user_id, "rooms"].get(room_id)
|
||||
|
||||
if room_item:
|
||||
room_item.unverified_devices = \
|
||||
self.client.room_contains_unverified(room_id)
|
||||
else:
|
||||
await self.client.register_nio_room(room)
|
||||
|
||||
|
||||
|
||||
# Room events, invite events and misc events callbacks
|
||||
|
||||
async def onRoomMessageText(
|
||||
|
|
|
@ -122,6 +122,36 @@ Rectangle {
|
|||
visible: center
|
||||
}
|
||||
|
||||
HButton {
|
||||
id: encryptionStatusButton
|
||||
padded: false
|
||||
visible: Layout.preferredWidth > 0
|
||||
backgroundColor: "transparent"
|
||||
|
||||
icon.name:
|
||||
chat.roomInfo.unverified_devices ?
|
||||
"device-unset" :
|
||||
"device-verified"
|
||||
|
||||
icon.color:
|
||||
chat.roomInfo.unverified_devices ?
|
||||
theme.colors.warningText :
|
||||
theme.colors.positiveText
|
||||
|
||||
toolTip.text:
|
||||
chat.roomInfo.unverified_devices ?
|
||||
qsTr("Some members in this encrypted room have " +
|
||||
"unverified devices") :
|
||||
qsTr("All members in this encrypted room are verified")
|
||||
|
||||
onClicked: toolTip.instantShow()
|
||||
|
||||
Layout.preferredWidth: chat.roomInfo.encrypted ? avatar.width : 0
|
||||
Layout.fillHeight: true
|
||||
|
||||
Behavior on Layout.preferredWidth { HNumberAnimation {} }
|
||||
}
|
||||
|
||||
HButton {
|
||||
id: goToRoomPaneButton
|
||||
padded: false
|
||||
|
|
Loading…
Reference in New Issue
Block a user