Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2020-04-22 13:22:33 +01:00
parent 01abb61e9a
commit 54e976f5a8

View file

@ -66,7 +66,7 @@ import { storeRoomAliasInCache } from '../../RoomAliasCache';
import {defer, IDeferred} from "../../utils/promise"; import {defer, IDeferred} from "../../utils/promise";
import ToastStore from "../../stores/ToastStore"; import ToastStore from "../../stores/ToastStore";
import * as StorageManager from "../../utils/StorageManager"; import * as StorageManager from "../../utils/StorageManager";
import type LoggedInView from "./LoggedInView"; import type LoggedInViewType from "./LoggedInView";
/** constants for MatrixChat.state.view */ /** constants for MatrixChat.state.view */
export enum VIEWS { export enum VIEWS {
@ -214,7 +214,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
private focusComposer: boolean; private focusComposer: boolean;
private subTitleStatus: string; private subTitleStatus: string;
private readonly loggedInView: React.RefObject<LoggedInView>; private readonly loggedInView: React.RefObject<LoggedInViewType>;
private readonly dispatcherRef: any; private readonly dispatcherRef: any;
private readonly themeWatcher: ThemeWatcher; private readonly themeWatcher: ThemeWatcher;
@ -823,7 +823,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
} }
let roomIndex = -1; let roomIndex = -1;
for (let i = 0; i < allRooms.length; ++i) { for (let i = 0; i < allRooms.length; ++i) {
if (allRooms[i].roomId == this.state.currentRoomId) { if (allRooms[i].roomId === this.state.currentRoomId) {
roomIndex = i; roomIndex = i;
break; break;
} }
@ -1194,7 +1194,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
// the saved sync to be loaded). // the saved sync to be loaded).
const saveWelcomeUser = (ev) => { const saveWelcomeUser = (ev) => {
if ( if (
ev.getType() == 'm.direct' && ev.getType() === 'm.direct' &&
ev.getContent() && ev.getContent() &&
ev.getContent()[this.props.config.welcomeUserId] ev.getContent()[this.props.config.welcomeUserId]
) { ) {
@ -1482,12 +1482,12 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
Modal.createTrackedDialog('Crypto migrated', '', ErrorDialog, { Modal.createTrackedDialog('Crypto migrated', '', ErrorDialog, {
title: _t('Old cryptography data detected'), title: _t('Old cryptography data detected'),
description: _t( description: _t(
"Data from an older version of Riot has been detected. "+ "Data from an older version of Riot has been detected. " +
"This will have caused end-to-end cryptography to malfunction "+ "This will have caused end-to-end cryptography to malfunction " +
"in the older version. End-to-end encrypted messages exchanged "+ "in the older version. End-to-end encrypted messages exchanged " +
"recently whilst using the older version may not be decryptable "+ "recently whilst using the older version may not be decryptable " +
"in this version. This may also cause messages exchanged with this "+ "in this version. This may also cause messages exchanged with this " +
"version to fail. If you experience problems, log out and back in "+ "version to fail. If you experience problems, log out and back in " +
"again. To retain message history, export and re-import your keys.", "again. To retain message history, export and re-import your keys.",
), ),
}); });
@ -1590,17 +1590,17 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
} }
showScreen(screen: string, params?: {[key: string]: any}) { showScreen(screen: string, params?: {[key: string]: any}) {
if (screen == 'register') { if (screen === 'register') {
dis.dispatch({ dis.dispatch({
action: 'start_registration', action: 'start_registration',
params: params, params: params,
}); });
} else if (screen == 'login') { } else if (screen === 'login') {
dis.dispatch({ dis.dispatch({
action: 'start_login', action: 'start_login',
params: params, params: params,
}); });
} else if (screen == 'forgot_password') { } else if (screen === 'forgot_password') {
dis.dispatch({ dis.dispatch({
action: 'start_password_recovery', action: 'start_password_recovery',
params: params, params: params,
@ -1616,32 +1616,32 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
params: params, params: params,
}); });
} }
} else if (screen == 'new') { } else if (screen === 'new') {
dis.dispatch({ dis.dispatch({
action: 'view_create_room', action: 'view_create_room',
}); });
} else if (screen == 'settings') { } else if (screen === 'settings') {
dis.dispatch({ dis.dispatch({
action: 'view_user_settings', action: 'view_user_settings',
}); });
} else if (screen == 'welcome') { } else if (screen === 'welcome') {
dis.dispatch({ dis.dispatch({
action: 'view_welcome_page', action: 'view_welcome_page',
}); });
} else if (screen == 'home') { } else if (screen === 'home') {
dis.dispatch({ dis.dispatch({
action: 'view_home_page', action: 'view_home_page',
}); });
} else if (screen == 'start') { } else if (screen === 'start') {
this.showScreen('home'); this.showScreen('home');
dis.dispatch({ dis.dispatch({
action: 'require_registration', action: 'require_registration',
}); });
} else if (screen == 'directory') { } else if (screen === 'directory') {
dis.dispatch({ dis.dispatch({
action: 'view_room_directory', action: 'view_room_directory',
}); });
} else if (screen == 'groups') { } else if (screen === 'groups') {
dis.dispatch({ dis.dispatch({
action: 'view_my_groups', action: 'view_my_groups',
}); });
@ -1649,11 +1649,11 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
dis.dispatch({ dis.dispatch({
action: 'start_complete_security', action: 'start_complete_security',
}); });
} else if (screen == 'post_registration') { } else if (screen === 'post_registration') {
dis.dispatch({ dis.dispatch({
action: 'start_post_registration', action: 'start_post_registration',
}); });
} else if (screen.indexOf('room/') == 0) { } else if (screen.indexOf('room/') === 0) {
// Rooms can have the following formats: // Rooms can have the following formats:
// #room_alias:domain or !opaque_id:domain // #room_alias:domain or !opaque_id:domain
const room = screen.substring(5); const room = screen.substring(5);
@ -1710,21 +1710,21 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
room_alias: undefined, room_alias: undefined,
room_id: undefined, room_id: undefined,
}; };
if (roomString[0] == '#') { if (roomString[0] === '#') {
payload.room_alias = roomString; payload.room_alias = roomString;
} else { } else {
payload.room_id = roomString; payload.room_id = roomString;
} }
dis.dispatch(payload); dis.dispatch(payload);
} else if (screen.indexOf('user/') == 0) { } else if (screen.indexOf('user/') === 0) {
const userId = screen.substring(5); const userId = screen.substring(5);
dis.dispatch({ dis.dispatch({
action: 'view_user_info', action: 'view_user_info',
userId: userId, userId: userId,
subAction: params.action, subAction: params.action,
}); });
} else if (screen.indexOf('group/') == 0) { } else if (screen.indexOf('group/') === 0) {
const groupId = screen.substring(6); const groupId = screen.substring(6);
// TODO: Check valid group ID // TODO: Check valid group ID
@ -1853,7 +1853,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
}); });
} }
private setPageSubtitle(subtitle='') { private setPageSubtitle(subtitle = '') {
if (this.state.currentRoomId) { if (this.state.currentRoomId) {
const client = MatrixClientPeg.get(); const client = MatrixClientPeg.get();
const room = client && client.getRoom(this.state.currentRoomId); const room = client && client.getRoom(this.state.currentRoomId);