1
0
Fork 0
forked from Mirrors/gomuks

web/rightpanel: mark unverified devices as red if cross-signing keys exist

This commit is contained in:
Tulir Asokan 2024-12-07 15:11:02 +02:00
parent cc2f334502
commit 5ee25b83d4
2 changed files with 12 additions and 8 deletions

View file

@ -151,11 +151,11 @@ div.right-panel-content.user {
height: 1.5rem;
width: 1.5rem;
&.trust-blacklisted {
&.trust-blacklisted, &.trust-unverified.has-master-key {
color: var(--error-color);
}
&.trust-cross-signed-untrusted, &.trust-unverified {
&.trust-cross-signed-untrusted, &.trust-unverified.no-master-key {
color: darkorange;
}

View file

@ -85,13 +85,13 @@ const DeviceList = ({ client, room, userID }: DeviceListProps) => {
{verifiedMessage}
<details>
<summary><h4>{view.devices.length} devices</h4></summary>
<ul>{view.devices.map(renderDevice)}</ul>
<ul>{view.devices.map(dev => renderDevice(dev, view.master_key !== ""))}</ul>
</details>
<UserInfoError errors={errors}/>
</div>
}
function renderDevice(device: ProfileDevice) {
function renderDevice(device: ProfileDevice, hasCSKeys: boolean) {
let Icon = EncryptedIcon
if (device.trust_state === "blacklisted") {
Icon = EncryptedOffIcon
@ -100,19 +100,23 @@ function renderDevice(device: ProfileDevice) {
}
return <li key={device.device_id} className="device">
<div
className={`icon-wrapper trust-${device.trust_state}`}
title={trustStateDescription(device.trust_state)}
className={`icon-wrapper trust-${device.trust_state} ${hasCSKeys ? "has-master-key" : "no-master-key"}`}
title={trustStateDescription(device.trust_state, hasCSKeys)}
><Icon/></div>
<div title={device.device_id}>{device.name || device.device_id}</div>
</li>
}
function trustStateDescription(state: TrustState): string {
function trustStateDescription(state: TrustState, hasCSKeys: boolean): string {
switch (state) {
case "blacklisted":
return "Device has been blacklisted manually"
case "unverified":
return "Device has not been verified by cross-signing keys, or cross-signing keys were not found"
if (hasCSKeys) {
return "Device has not been verified by cross-signing keys"
} else {
return "No cross-signing keys were found"
}
case "verified":
return "Device was verified manually"
case "cross-signed-untrusted":