forked from Mirrors/gomuks
web/rightpanel: mark unverified devices as red if cross-signing keys exist
This commit is contained in:
parent
cc2f334502
commit
5ee25b83d4
2 changed files with 12 additions and 8 deletions
|
@ -151,11 +151,11 @@ div.right-panel-content.user {
|
||||||
height: 1.5rem;
|
height: 1.5rem;
|
||||||
width: 1.5rem;
|
width: 1.5rem;
|
||||||
|
|
||||||
&.trust-blacklisted {
|
&.trust-blacklisted, &.trust-unverified.has-master-key {
|
||||||
color: var(--error-color);
|
color: var(--error-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
&.trust-cross-signed-untrusted, &.trust-unverified {
|
&.trust-cross-signed-untrusted, &.trust-unverified.no-master-key {
|
||||||
color: darkorange;
|
color: darkorange;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,13 +85,13 @@ const DeviceList = ({ client, room, userID }: DeviceListProps) => {
|
||||||
{verifiedMessage}
|
{verifiedMessage}
|
||||||
<details>
|
<details>
|
||||||
<summary><h4>{view.devices.length} devices</h4></summary>
|
<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>
|
</details>
|
||||||
<UserInfoError errors={errors}/>
|
<UserInfoError errors={errors}/>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderDevice(device: ProfileDevice) {
|
function renderDevice(device: ProfileDevice, hasCSKeys: boolean) {
|
||||||
let Icon = EncryptedIcon
|
let Icon = EncryptedIcon
|
||||||
if (device.trust_state === "blacklisted") {
|
if (device.trust_state === "blacklisted") {
|
||||||
Icon = EncryptedOffIcon
|
Icon = EncryptedOffIcon
|
||||||
|
@ -100,19 +100,23 @@ function renderDevice(device: ProfileDevice) {
|
||||||
}
|
}
|
||||||
return <li key={device.device_id} className="device">
|
return <li key={device.device_id} className="device">
|
||||||
<div
|
<div
|
||||||
className={`icon-wrapper trust-${device.trust_state}`}
|
className={`icon-wrapper trust-${device.trust_state} ${hasCSKeys ? "has-master-key" : "no-master-key"}`}
|
||||||
title={trustStateDescription(device.trust_state)}
|
title={trustStateDescription(device.trust_state, hasCSKeys)}
|
||||||
><Icon/></div>
|
><Icon/></div>
|
||||||
<div title={device.device_id}>{device.name || device.device_id}</div>
|
<div title={device.device_id}>{device.name || device.device_id}</div>
|
||||||
</li>
|
</li>
|
||||||
}
|
}
|
||||||
|
|
||||||
function trustStateDescription(state: TrustState): string {
|
function trustStateDescription(state: TrustState, hasCSKeys: boolean): string {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case "blacklisted":
|
case "blacklisted":
|
||||||
return "Device has been blacklisted manually"
|
return "Device has been blacklisted manually"
|
||||||
case "unverified":
|
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":
|
case "verified":
|
||||||
return "Device was verified manually"
|
return "Device was verified manually"
|
||||||
case "cross-signed-untrusted":
|
case "cross-signed-untrusted":
|
||||||
|
|
Loading…
Add table
Reference in a new issue