TypeScript strict fixes (#10138)
This commit is contained in:
parent
e57f6f0257
commit
f0f50485d7
4 changed files with 18 additions and 10 deletions
|
@ -182,11 +182,11 @@ export default class UserActivity {
|
|||
this.activeRecentlyTimeout.abort();
|
||||
};
|
||||
|
||||
private onUserActivity = (event: MouseEvent): void => {
|
||||
private onUserActivity = (event: Event): void => {
|
||||
// ignore anything if the window isn't focused
|
||||
if (!this.document.hasFocus()) return;
|
||||
|
||||
if (event.screenX && event.type === "mousemove") {
|
||||
if (event.type === "mousemove" && this.isMouseEvent(event)) {
|
||||
if (event.screenX === this.lastScreenX && event.screenY === this.lastScreenY) {
|
||||
// mouse hasn't actually moved
|
||||
return;
|
||||
|
@ -223,4 +223,8 @@ export default class UserActivity {
|
|||
}
|
||||
attachedTimers.forEach((t) => t.abort());
|
||||
}
|
||||
|
||||
private isMouseEvent(event: Event): event is MouseEvent {
|
||||
return event.type.startsWith("mouse");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ export default class VoipUserMapper {
|
|||
return window.mxVoipUserMapper;
|
||||
}
|
||||
|
||||
private async userToVirtualUser(userId: string): Promise<string> {
|
||||
private async userToVirtualUser(userId: string): Promise<string | null> {
|
||||
const results = await LegacyCallHandler.instance.sipVirtualLookup(userId);
|
||||
if (results.length === 0 || !results[0].fields.lookup_success) return null;
|
||||
return results[0].userid;
|
||||
|
@ -59,11 +59,11 @@ export default class VoipUserMapper {
|
|||
if (!virtualUser) return null;
|
||||
|
||||
const virtualRoomId = await ensureVirtualRoomExists(MatrixClientPeg.get(), virtualUser, roomId);
|
||||
MatrixClientPeg.get().setRoomAccountData(virtualRoomId, VIRTUAL_ROOM_EVENT_TYPE, {
|
||||
MatrixClientPeg.get().setRoomAccountData(virtualRoomId!, VIRTUAL_ROOM_EVENT_TYPE, {
|
||||
native_room: roomId,
|
||||
});
|
||||
|
||||
this.virtualToNativeRoomIdCache.set(virtualRoomId, roomId);
|
||||
this.virtualToNativeRoomIdCache.set(virtualRoomId!, roomId);
|
||||
|
||||
return virtualRoomId;
|
||||
}
|
||||
|
@ -121,8 +121,12 @@ export default class VoipUserMapper {
|
|||
if (!LegacyCallHandler.instance.getSupportsVirtualRooms()) return;
|
||||
|
||||
const inviterId = invitedRoom.getDMInviter();
|
||||
if (!inviterId) {
|
||||
logger.error("Could not find DM inviter for room id: " + invitedRoom.roomId);
|
||||
}
|
||||
|
||||
logger.log(`Checking virtual-ness of room ID ${invitedRoom.roomId}, invited by ${inviterId}`);
|
||||
const result = await LegacyCallHandler.instance.sipNativeLookup(inviterId);
|
||||
const result = await LegacyCallHandler.instance.sipNativeLookup(inviterId!);
|
||||
if (result.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -21,11 +21,11 @@ import { MatrixClientPeg } from "./MatrixClientPeg";
|
|||
import { _t } from "./languageHandler";
|
||||
|
||||
export function usersTypingApartFromMeAndIgnored(room: Room): RoomMember[] {
|
||||
return usersTyping(room, [MatrixClientPeg.get().getUserId()].concat(MatrixClientPeg.get().getIgnoredUsers()));
|
||||
return usersTyping(room, [MatrixClientPeg.get().getUserId()!].concat(MatrixClientPeg.get().getIgnoredUsers()));
|
||||
}
|
||||
|
||||
export function usersTypingApartFromMe(room: Room): RoomMember[] {
|
||||
return usersTyping(room, [MatrixClientPeg.get().getUserId()]);
|
||||
return usersTyping(room, [MatrixClientPeg.get().getUserId()!]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -36,7 +36,7 @@ export function usersTypingApartFromMe(room: Room): RoomMember[] {
|
|||
* @returns {RoomMember[]} list of user objects who are typing.
|
||||
*/
|
||||
export function usersTyping(room: Room, exclude: string[] = []): RoomMember[] {
|
||||
const whoIsTyping = [];
|
||||
const whoIsTyping: RoomMember[] = [];
|
||||
|
||||
const memberKeys = Object.keys(room.currentState.members);
|
||||
for (const userId of memberKeys) {
|
||||
|
|
|
@ -120,7 +120,7 @@ function setRightPanel(state: IRightPanelCardState): void {
|
|||
}
|
||||
}
|
||||
|
||||
export function pendingVerificationRequestForUser(user: User | RoomMember): VerificationRequest {
|
||||
export function pendingVerificationRequestForUser(user: User | RoomMember): VerificationRequest | undefined {
|
||||
const cli = MatrixClientPeg.get();
|
||||
const dmRoom = findDMForUser(cli, user.userId);
|
||||
if (dmRoom) {
|
||||
|
|
Loading…
Reference in a new issue