Implement blacklisting from verification key popup

This commit is contained in:
miruka 2020-06-26 02:16:00 -04:00
parent bcbc356a98
commit edc73c6952
4 changed files with 20 additions and 2 deletions

View File

@ -1331,6 +1331,11 @@ class MatrixClient(nio.AsyncClient):
self.verify_device(self.olm.device_store[user_id][device_id])
async def blacklist_device_id(self, user_id: str, device_id: str) -> None:
"""Mark a device as blacklisted."""
self.blacklist_device(self.olm.device_store[user_id][device_id])
# Functions to register/modify data into models

View File

@ -14,6 +14,7 @@ HTile {
property string userId
signal verified()
signal blacklisted()
signal renameRequest(string name)
@ -157,6 +158,7 @@ HTile {
ed25519Key: model.ed25519_key,
deviceIsCurrent: model.type === "current",
verifiedCallback: deviceTile.verified,
blacklistedCallback: deviceTile.blacklisted,
},
)
}

View File

@ -80,6 +80,7 @@ HColumnPage {
view: deviceList
userId: page.userId
onVerified: page.loadDevices()
onBlacklisted: page.loadDevices()
onRenameRequest: name => renameDevice(model.index, name)
}

View File

@ -16,6 +16,7 @@ HFlickableColumnPopup {
property string ed25519Key
property bool deviceIsCurrent: false
property var verifiedCallback: null
property var blacklistedCallback: null
page.footer: ButtonLayout {
@ -43,8 +44,17 @@ HFlickableColumnPopup {
text: qsTr("They differ")
icon.name: "device-blacklisted"
onClicked: {
// XXX
popup.close()
loading = true
py.callClientCoro(
userId,
"blacklist_device_id",
[deviceOwner, deviceId],
() => {
if (blacklistedCallback) blacklistedCallback()
popup.close()
}
)
}
}