Apply prettier formatting

This commit is contained in:
Michael Weimann
2022-12-12 12:24:14 +01:00
parent 1cac306093
commit 526645c791
1576 changed files with 65385 additions and 62478 deletions
+17 -22
View File
@@ -18,19 +18,19 @@ import { logger } from "matrix-js-sdk/src/logger";
import { CryptoEvent } from "matrix-js-sdk/src/crypto";
import { Optional } from "matrix-events-sdk";
import defaultDispatcher from '../../dispatcher/dispatcher';
import { pendingVerificationRequestForUser } from '../../verification';
import defaultDispatcher from "../../dispatcher/dispatcher";
import { pendingVerificationRequestForUser } from "../../verification";
import SettingsStore from "../../settings/SettingsStore";
import { RightPanelPhases } from "./RightPanelStorePhases";
import { SettingLevel } from "../../settings/SettingLevel";
import { UPDATE_EVENT } from '../AsyncStore';
import { ReadyWatchingStore } from '../ReadyWatchingStore';
import { UPDATE_EVENT } from "../AsyncStore";
import { ReadyWatchingStore } from "../ReadyWatchingStore";
import {
convertToStatePanel,
convertToStorePanel,
IRightPanelCard,
IRightPanelForRoom,
} from './RightPanelStoreIPanelState';
} from "./RightPanelStoreIPanelState";
import { ActionPayload } from "../../dispatcher/payloads";
import { Action } from "../../dispatcher/actions";
import { ActiveRoomChangedPayload } from "../../dispatcher/payloads/ActiveRoomChangedPayload";
@@ -41,7 +41,7 @@ import { SdkContextClass } from "../../contexts/SDKContext";
* sessions. This state includes a history for each room. Each history element
* contains the phase (e.g. RightPanelPhase.RoomMemberInfo) and the state (e.g.
* the member) associated with it.
*/
*/
export default class RightPanelStore extends ReadyWatchingStore {
private static internalInstance: RightPanelStore;
@@ -144,7 +144,7 @@ export default class RightPanelStore extends ReadyWatchingStore {
// Checks for wrong SetRightPanelPhase requests
if (!this.isPhaseValid(targetPhase, Boolean(rId))) return;
if ((targetPhase === this.currentCardForRoom(rId)?.phase && !!cardState)) {
if (targetPhase === this.currentCardForRoom(rId)?.phase && !!cardState) {
// Update state: set right panel with a new state but keep the phase (don't know it this is ever needed...)
const hist = this.byRoom[rId]?.history ?? [];
hist[hist.length - 1].state = cardState;
@@ -163,18 +163,14 @@ export default class RightPanelStore extends ReadyWatchingStore {
public setCards(cards: IRightPanelCard[], allowClose = true, roomId: string = null) {
// This function sets the history of the right panel and shows the right panel if not already visible.
const rId = roomId ?? this.viewedRoomId;
const history = cards.map(c => ({ phase: c.phase, state: c.state ?? {} }));
const history = cards.map((c) => ({ phase: c.phase, state: c.state ?? {} }));
this.byRoom[rId] = { history, isOpen: true };
this.show(rId);
this.emitAndUpdateSettings();
}
// Appends a card to the history and shows the right panel if not already visible
public pushCard(
card: IRightPanelCard,
allowClose = true,
roomId: string = null,
) {
public pushCard(card: IRightPanelCard, allowClose = true, roomId: string = null) {
const rId = roomId ?? this.viewedRoomId;
const redirect = this.getVerificationRedirect(card);
const targetPhase = redirect?.phase ?? card.phase;
@@ -233,9 +229,10 @@ export default class RightPanelStore extends ReadyWatchingStore {
if (this.viewedRoomId) {
const room = this.mxClient?.getRoom(this.viewedRoomId);
if (!!room) {
this.global = this.global ??
convertToStatePanel(SettingsStore.getValue("RightPanel.phasesGlobal"), room);
this.byRoom[this.viewedRoomId] = this.byRoom[this.viewedRoomId] ??
this.global =
this.global ?? convertToStatePanel(SettingsStore.getValue("RightPanel.phasesGlobal"), room);
this.byRoom[this.viewedRoomId] =
this.byRoom[this.viewedRoomId] ??
convertToStatePanel(SettingsStore.getValue("RightPanel.phases", this.viewedRoomId), room);
} else {
logger.warn(
@@ -337,7 +334,7 @@ export default class RightPanelStore extends ReadyWatchingStore {
if (!isViewingRoom) {
logger.warn(
`Tried to switch right panel to a room phase: ${targetPhase}, ` +
`but we are currently not viewing a room`,
`but we are currently not viewing a room`,
);
return false;
}
@@ -367,7 +364,8 @@ export default class RightPanelStore extends ReadyWatchingStore {
const panel = this.byRoom[this.viewedRoomId];
if (panel?.history) {
panel.history = panel.history.filter(
(card) => card.phase != RightPanelPhases.RoomMemberInfo &&
(card) =>
card.phase != RightPanelPhases.RoomMemberInfo &&
card.phase != RightPanelPhases.Room3pidMemberInfo,
);
}
@@ -376,10 +374,7 @@ export default class RightPanelStore extends ReadyWatchingStore {
// If the right panel stays open mode is used, and the panel was either
// closed or never shown for that room, then force it open and display
// the room member list.
if (
SettingsStore.getValue("feature_right_panel_default_open") &&
!this.byRoom[this.viewedRoomId]?.isOpen
) {
if (SettingsStore.getValue("feature_right_panel_default_open") && !this.byRoom[this.viewedRoomId]?.isOpen) {
const history = [{ phase: RightPanelPhases.RoomMemberList }];
const room = this.viewedRoomId && this.mxClient?.getRoom(this.viewedRoomId);
if (!room?.isSpaceRoom()) {