Merge pull request #4303 from matrix-org/jryans/id-change-red

Show red shield for users that become unverified
This commit is contained in:
J. Ryan Stinnett
2020-03-31 10:07:28 +01:00
committed by GitHub
4 changed files with 30 additions and 7 deletions
+4 -2
View File
@@ -68,8 +68,10 @@ export const getE2EStatus = (cli, userId, devices) => {
return hasUnverifiedDevice ? "warning" : "verified";
}
const isMe = userId === cli.getUserId();
const userVerified = cli.checkUserTrust(userId).isCrossSigningVerified();
if (!userVerified) return "normal";
const userTrust = cli.checkUserTrust(userId);
if (!userTrust.isCrossSigningVerified()) {
return userTrust.wasCrossSigningVerified() ? "warning" : "normal";
}
const anyDeviceUnverified = devices.some(device => {
const { deviceId } = device;
+3 -3
View File
@@ -121,10 +121,10 @@ export default createReactClass({
const cli = MatrixClientPeg.get();
const { userId } = this.props.member;
const isMe = userId === cli.getUserId();
const userVerified = cli.checkUserTrust(userId).isCrossSigningVerified();
if (!userVerified) {
const userTrust = cli.checkUserTrust(userId);
if (!userTrust.isCrossSigningVerified()) {
this.setState({
e2eStatus: "normal",
e2eStatus: userTrust.wasCrossSigningVerified() ? "warning" : "normal",
});
return;
}
+8
View File
@@ -5,6 +5,7 @@ interface Client {
getUserId: () => string;
checkUserTrust: (userId: string) => {
isCrossSigningVerified: () => boolean
wasCrossSigningVerified: () => boolean
};
getStoredDevicesForUser: (userId: string) => Promise<[{ deviceId: string }]>;
checkDeviceTrust: (userId: string, deviceId: string) => {
@@ -29,6 +30,13 @@ export async function shieldStatusForRoom(client: Client, room: Room): Promise<s
verified : unverified).push(userId);
});
/* Alarm if any unverified users were verified before. */
for (const userId of unverified) {
if (client.checkUserTrust(userId).wasCrossSigningVerified()) {
return "warning";
}
}
/* Check all verified user devices. */
/* Don't alarm if no other users are verified */
const includeUser = (verified.length > 0) && // Don't alarm for self in rooms where nobody else is verified