review feedback
This commit is contained in:
@@ -55,7 +55,7 @@ import RightPanelStore from "../../stores/RightPanelStore";
|
||||
import {haveTileForEvent} from "../views/rooms/EventTile";
|
||||
import RoomContext from "../../contexts/RoomContext";
|
||||
import MatrixClientContext from "../../contexts/MatrixClientContext";
|
||||
import { shieldStatusForMembership } from '../../utils/ShieldUtils';
|
||||
import { shieldStatusForRoom } from '../../utils/ShieldUtils';
|
||||
|
||||
const DEBUG = false;
|
||||
let debuglog = function() {};
|
||||
@@ -820,7 +820,7 @@ export default createReactClass({
|
||||
|
||||
/* At this point, the user has encryption on and cross-signing on */
|
||||
this.setState({
|
||||
e2eStatus: await shieldStatusForMembership(this.context, room),
|
||||
e2eStatus: await shieldStatusForRoom(this.context, room),
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ import E2EIcon from './E2EIcon';
|
||||
import InviteOnlyIcon from './InviteOnlyIcon';
|
||||
// eslint-disable-next-line camelcase
|
||||
import rate_limited_func from '../../../ratelimitedfunc';
|
||||
import { shieldStatusForMembership } from '../../../utils/ShieldUtils';
|
||||
import { shieldStatusForRoom } from '../../../utils/ShieldUtils';
|
||||
|
||||
export default createReactClass({
|
||||
displayName: 'RoomTile',
|
||||
@@ -157,7 +157,7 @@ export default createReactClass({
|
||||
|
||||
/* At this point, the user has encryption on and cross-signing on */
|
||||
this.setState({
|
||||
e2eStatus: await shieldStatusForMembership(cli, this.props.room),
|
||||
e2eStatus: await shieldStatusForRoom(cli, this.props.room),
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ interface Room {
|
||||
roomId: string;
|
||||
}
|
||||
|
||||
export async function shieldStatusForMembership(client: Client, room: Room): Promise<string> {
|
||||
export async function shieldStatusForRoom(client: Client, room: Room): Promise<string> {
|
||||
const members = (await room.getEncryptionTargetMembers()).map(({userId}) => userId);
|
||||
const inDMMap = !!DMRoomMap.shared().getUserIdForRoomId(room.roomId);
|
||||
|
||||
@@ -33,8 +33,8 @@ export async function shieldStatusForMembership(client: Client, room: Room): Pro
|
||||
/* 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
|
||||
!inDMMap && // Don't alarm for self in DMs with other users
|
||||
(members.length !== 2) || // Don't alarm for self in 1:1 chats with other users
|
||||
(members.length === 1); // Do alarm for self if we're alone in a room
|
||||
(members.length !== 2) || // Don't alarm for self in 1:1 chats with other users
|
||||
(members.length === 1); // Do alarm for self if we're alone in a room
|
||||
const targets = includeUser ? [...verified, client.getUserId()] : verified;
|
||||
for (const userId of targets) {
|
||||
const devices = await client.getStoredDevicesForUser(userId);
|
||||
|
||||
Reference in New Issue
Block a user