Merge pull request #6285 from matrix-org/jryans/rework-linting-2

Migrate to `eslint-plugin-matrix-org`
This commit is contained in:
J. Ryan Stinnett 2021-06-29 17:45:10 +01:00 committed by GitHub
commit 9d6d8fc666
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
636 changed files with 3460 additions and 3935 deletions

View file

@ -16,8 +16,8 @@ limitations under the License.
import EventEmitter from 'events';
import {MatrixClientPeg} from '../MatrixClientPeg';
import {WidgetMessagingStore} from "./widgets/WidgetMessagingStore";
import { MatrixClientPeg } from '../MatrixClientPeg';
import { WidgetMessagingStore } from "./widgets/WidgetMessagingStore";
/**
* Stores information about the widgets active in the app right now:

View file

@ -66,13 +66,13 @@ export class BreadcrumbsStore extends AsyncStoreWithClient<IState> {
if (payload.settingName === 'breadcrumb_rooms') {
await this.updateRooms();
} else if (payload.settingName === 'breadcrumbs') {
await this.updateState({enabled: SettingsStore.getValue("breadcrumbs", null)});
await this.updateState({ enabled: SettingsStore.getValue("breadcrumbs", null) });
}
} else if (payload.action === 'view_room') {
if (payload.auto_join && !this.matrixClient.getRoom(payload.room_id)) {
// Queue the room instead of pushing it immediately. We're probably just
// waiting for a room join to complete.
this.waitingRooms.push({roomId: payload.room_id, addedTs: Date.now()});
this.waitingRooms.push({ roomId: payload.room_id, addedTs: Date.now() });
} else {
// The tests might not result in a valid room object.
const room = this.matrixClient.getRoom(payload.room_id);
@ -83,7 +83,7 @@ export class BreadcrumbsStore extends AsyncStoreWithClient<IState> {
protected async onReady() {
await this.updateRooms();
await this.updateState({enabled: SettingsStore.getValue("breadcrumbs", null)});
await this.updateState({ enabled: SettingsStore.getValue("breadcrumbs", null) });
this.matrixClient.on("Room.myMembership", this.onMyMembership);
this.matrixClient.on("Room", this.onRoom);
@ -118,7 +118,7 @@ export class BreadcrumbsStore extends AsyncStoreWithClient<IState> {
const rooms = roomIds.map(r => this.matrixClient.getRoom(r)).filter(r => !!r);
const currentRooms = this.state.rooms || [];
if (!arrayHasDiff(rooms, currentRooms)) return; // no change (probably echo)
await this.updateState({rooms});
await this.updateState({ rooms });
}
private async appendRoom(room: Room) {
@ -163,10 +163,9 @@ export class BreadcrumbsStore extends AsyncStoreWithClient<IState> {
updated = true;
}
if (updated) {
// Update the breadcrumbs
await this.updateState({rooms});
await this.updateState({ rooms });
const roomIds = rooms.map(r => r.roomId);
if (roomIds.length > 0) {
await SettingsStore.setValue("breadcrumb_rooms", null, SettingLevel.ACCOUNT, roomIds);

View file

@ -126,11 +126,11 @@ export class CommunityPrototypeStore extends AsyncStoreWithClient<IState> {
if (membership === EffectiveMembership.Invite) {
try {
const path = utils.encodeUri("/rooms/$roomId/group_info", {$roomId: room.roomId});
const path = utils.encodeUri("/rooms/$roomId/group_info", { $roomId: room.roomId });
const profile = await this.matrixClient.http.authedRequest(
undefined, "GET", path,
undefined, undefined,
{prefix: "/_matrix/client/unstable/im.vector.custom"});
{ prefix: "/_matrix/client/unstable/im.vector.custom" });
// we use global account data because per-room account data on invites is unreliable
await this.matrixClient.setAccountData("im.vector.group_info." + room.roomId, profile);
} catch (e) {
@ -155,7 +155,7 @@ export class CommunityPrototypeStore extends AsyncStoreWithClient<IState> {
}
public getInviteProfile(roomId: string): IRoomProfile {
if (!this.matrixClient) return {displayName: null, avatarMxc: null};
if (!this.matrixClient) return { displayName: null, avatarMxc: null };
const room = this.matrixClient.getRoom(roomId);
if (SettingsStore.getValue("feature_communities_v2_prototypes")) {
const data = this.matrixClient.getAccountData("im.vector.group_info." + roomId);

View file

@ -17,12 +17,12 @@ limitations under the License.
import dis from '../dispatcher/dispatcher';
import EventEmitter from 'events';
import {throttle} from "lodash";
import { throttle } from "lodash";
import SettingsStore from "../settings/SettingsStore";
import RoomListStore, {LISTS_UPDATE_EVENT} from "./room-list/RoomListStore";
import {RoomNotificationStateStore} from "./notifications/RoomNotificationStateStore";
import {isCustomTag} from "./room-list/models";
import {objectHasDiff} from "../utils/objects";
import RoomListStore, { LISTS_UPDATE_EVENT } from "./room-list/RoomListStore";
import { RoomNotificationStateStore } from "./notifications/RoomNotificationStateStore";
import { isCustomTag } from "./room-list/models";
import { objectHasDiff } from "../utils/objects";
function commonPrefix(a, b) {
const len = Math.min(a.length, b.length);
@ -52,7 +52,7 @@ class CustomRoomTagStore extends EventEmitter {
constructor() {
super();
// Initialise state
this._state = {tags: {}};
this._state = { tags: {} };
// as RoomListStore gets updated by every timeline event
// throttle this to only run every 500ms
@ -103,14 +103,14 @@ class CustomRoomTagStore extends EventEmitter {
}
const avatarLetter = name.substr(prefixes[i].length, 1);
const selected = this._state.tags[name];
return {name, avatarLetter, badgeNotifState, selected};
return { name, avatarLetter, badgeNotifState, selected };
});
}
_onListsUpdated = () => {
const newTags = this._getUpdatedTags();
if (!this._state.tags || objectHasDiff(this._state.tags, newTags)) {
this._setState({tags: newTags});
this._setState({ tags: newTags });
}
};
@ -122,14 +122,14 @@ class CustomRoomTagStore extends EventEmitter {
const tag = {};
tag[payload.tag] = !oldTags[payload.tag];
const tags = Object.assign({}, oldTags, tag);
this._setState({tags});
this._setState({ tags });
}
break;
}
case 'on_client_not_viable':
case 'on_logged_out': {
// we assume to always have a tags object in the state
this._state = {tags: {}};
this._state = { tags: {} };
RoomListStore.instance.off(LISTS_UPDATE_EVENT, this._onListsUpdated);
break;
}

View file

@ -13,12 +13,12 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import {Store} from 'flux/utils';
import { Store } from 'flux/utils';
import dis from '../dispatcher/dispatcher';
import GroupStore from './GroupStore';
import Analytics from '../Analytics';
import * as RoomNotifs from "../RoomNotifs";
import {MatrixClientPeg} from '../MatrixClientPeg';
import { MatrixClientPeg } from '../MatrixClientPeg';
import SettingsStore from "../settings/SettingsStore";
const INITIAL_STATE = {
@ -213,7 +213,7 @@ class GroupFilterOrderStore extends Store {
changedBadges[groupId] = (badge && badge.count !== 0) ? badge : undefined;
});
const newBadges = Object.assign({}, this._state.badges, changedBadges);
this._setState({badges: newBadges});
this._setState({ badges: newBadges });
}
}
@ -231,7 +231,6 @@ class GroupFilterOrderStore extends Store {
const tags = this._state.orderedTagsAccountData || [];
const removedTags = new Set(this._state.removedTagsAccountData || []);
const tagsToKeep = tags.filter(
(t) => (t[0] !== '+' || groupIds.includes(t)) && !removedTags.has(t),
);

View file

@ -17,7 +17,7 @@ limitations under the License.
import EventEmitter from 'events';
import { groupMemberFromApiObject, groupRoomFromApiObject } from '../groups';
import FlairStore from './FlairStore';
import {MatrixClientPeg} from '../MatrixClientPeg';
import { MatrixClientPeg } from '../MatrixClientPeg';
import dis from '../dispatcher/dispatcher';
function parseMembersResponse(response) {

View file

@ -15,8 +15,8 @@ limitations under the License.
*/
import defaultDispatcher from "../dispatcher/dispatcher";
import {AsyncStore} from "./AsyncStore";
import {ActionPayload} from "../dispatcher/payloads";
import { AsyncStore } from "./AsyncStore";
import { ActionPayload } from "../dispatcher/payloads";
interface IState {
hostSignupActive?: boolean;
@ -26,7 +26,7 @@ export class HostSignupStore extends AsyncStore<IState> {
private static internalInstance = new HostSignupStore();
private constructor() {
super(defaultDispatcher, {hostSignupActive: false});
super(defaultDispatcher, { hostSignupActive: false });
}
public static get instance(): HostSignupStore {

View file

@ -17,10 +17,10 @@ limitations under the License.
import { AsyncStoreWithClient } from "./AsyncStoreWithClient";
import defaultDispatcher from "../dispatcher/dispatcher";
import { ActionPayload } from "../dispatcher/payloads";
import Modal, {IHandle, IModal} from "../Modal";
import Modal, { IHandle, IModal } from "../Modal";
import ModalWidgetDialog from "../components/views/dialogs/ModalWidgetDialog";
import {WidgetMessagingStore} from "./widgets/WidgetMessagingStore";
import {IModalWidgetOpenRequestData, IModalWidgetReturnData, Widget} from "matrix-widget-api";
import { WidgetMessagingStore } from "./widgets/WidgetMessagingStore";
import { IModalWidgetOpenRequestData, IModalWidgetReturnData, Widget } from "matrix-widget-api";
interface IState {
modal?: IModal<any>;
@ -56,7 +56,7 @@ export class ModalWidgetStore extends AsyncStoreWithClient<IState> {
if (this.modalInstance) return;
this.openSourceWidgetId = sourceWidget.id;
this.modalInstance = Modal.createTrackedDialog('Modal Widget', '', ModalWidgetDialog, {
widgetDefinition: {...requestData},
widgetDefinition: { ...requestData },
widgetRoomId,
sourceWidgetId: sourceWidget.id,
onFinished: (success: boolean, data?: IModalWidgetReturnData) => {

View file

@ -22,7 +22,7 @@ import { User } from "matrix-js-sdk/src/models/user";
import { throttle } from "lodash";
import { MatrixClientPeg } from "../MatrixClientPeg";
import { _t } from "../languageHandler";
import {mediaFromMxc} from "../customisations/Media";
import { mediaFromMxc } from "../customisations/Media";
interface IState {
displayName?: string;
@ -134,7 +134,7 @@ export class OwnProfileStore extends AsyncStoreWithClient<IState> {
} else {
window.localStorage.removeItem(KEY_AVATAR_URL);
}
await this.updateState({displayName: profileInfo.displayname, avatarUrl: profileInfo.avatar_url});
await this.updateState({ displayName: profileInfo.displayname, avatarUrl: profileInfo.avatar_url });
};
private onStateEvents = throttle(async (ev: MatrixEvent) => {
@ -142,5 +142,5 @@ export class OwnProfileStore extends AsyncStoreWithClient<IState> {
if (ev.getType() === 'm.room.member' && ev.getSender() === myUserId && ev.getStateKey() === myUserId) {
await this.onProfileUpdate();
}
}, 200, {trailing: true, leading: true});
}, 200, { trailing: true, leading: true });
}

View file

@ -15,12 +15,12 @@ limitations under the License.
*/
import dis from '../dispatcher/dispatcher';
import {pendingVerificationRequestForUser} from '../verification';
import {Store} from 'flux/utils';
import { pendingVerificationRequestForUser } from '../verification';
import { Store } from 'flux/utils';
import SettingsStore from "../settings/SettingsStore";
import {RightPanelPhases, RIGHT_PANEL_PHASES_NO_ARGS} from "./RightPanelStorePhases";
import {ActionPayload} from "../dispatcher/payloads";
import {Action} from '../dispatcher/actions';
import { RightPanelPhases, RIGHT_PANEL_PHASES_NO_ARGS } from "./RightPanelStorePhases";
import { ActionPayload } from "../dispatcher/payloads";
import { Action } from '../dispatcher/actions';
import { SettingLevel } from "../settings/SettingLevel";
import RoomViewStore from './RoomViewStore';
@ -152,12 +152,12 @@ export default class RightPanelStore extends Store<ActionPayload> {
// Reset to the member list if we're viewing member info
if (MEMBER_INFO_PHASES.includes(this.state.lastRoomPhase)) {
this.setState({lastRoomPhase: RightPanelPhases.RoomMemberList, lastRoomPhaseParams: {}});
this.setState({ lastRoomPhase: RightPanelPhases.RoomMemberList, lastRoomPhaseParams: {} });
}
// Do the same for groups
if (this.state.lastGroupPhase === RightPanelPhases.GroupMemberInfo) {
this.setState({lastGroupPhase: RightPanelPhases.GroupMemberList});
this.setState({ lastGroupPhase: RightPanelPhases.GroupMemberList });
}
break;
@ -167,7 +167,7 @@ export default class RightPanelStore extends Store<ActionPayload> {
const allowClose = payload.allowClose ?? true;
// redirect to EncryptionPanel if there is an ongoing verification request
if (targetPhase === RightPanelPhases.RoomMemberInfo && payload.refireParams) {
const {member} = payload.refireParams;
const { member } = payload.refireParams;
const pendingRequest = pendingVerificationRequestForUser(member);
if (pendingRequest) {
targetPhase = RightPanelPhases.EncryptionPanel;

View file

@ -167,11 +167,11 @@ export class SetupEncryptionStore extends EventEmitter {
this.phase = Phase.Done;
this.emit("update");
}
}
};
public onVerificationRequest = (request: VerificationRequest): void => {
this.setActiveVerificationRequest(request);
}
};
public onVerificationRequestChange = (): void => {
if (this.verificationRequest.cancelled) {
@ -188,7 +188,7 @@ export class SetupEncryptionStore extends EventEmitter {
this.phase = publicKeysTrusted ? Phase.Done : Phase.Busy;
this.emit("update");
}
}
};
public skip(): void {
this.phase = Phase.ConfirmSkip;

View file

@ -81,7 +81,7 @@ const validOrder = (order: string): string | undefined => {
// For sorting space children using a validated `order`, `m.room.create`'s `origin_server_ts`, `room_id`
export const getChildOrder = (order: string, creationTs: number, roomId: string): Array<Many<ListIteratee<any>>> => {
return [validOrder(order), creationTs, roomId];
}
};
const getRoomFn: FetchRoomFn = (room: Room) => {
return RoomNotificationStateStore.instance.getRoomState(room);
@ -353,18 +353,18 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
// build initial state of invited spaces as we would have missed the emitted events about the room at launch
this._invitedSpaces = new Set(this.sortRootSpaces(invitedSpaces));
this.emit(UPDATE_INVITED_SPACES, this.invitedSpaces);
}, 100, {trailing: true, leading: true});
}, 100, { trailing: true, leading: true });
private onSpaceUpdate = () => {
this.rebuild();
}
};
private showInHomeSpace = (room: Room) => {
if (SettingsStore.getValue("feature_spaces.all_rooms")) return true;
if (room.isSpaceRoom()) return false;
return !this.parentMap.get(room.roomId)?.size // put all orphaned rooms in the Home Space
|| DMRoomMap.shared().getUserIdForRoomId(room.roomId) // put all DMs in the Home Space
|| RoomListStore.instance.getTagsForRoom(room).includes(DefaultTagID.Favourite) // show all favourites
|| RoomListStore.instance.getTagsForRoom(room).includes(DefaultTagID.Favourite); // show all favourites
};
// Update a given room due to its tag changing (e.g DM-ness or Fav-ness)
@ -462,7 +462,7 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
return false;
}));
});
}, 100, {trailing: true, leading: true});
}, 100, { trailing: true, leading: true });
private switchToRelatedSpace = (roomId: string) => {
if (this.suggestedRooms.find(r => r.room_id === roomId)) return;
@ -584,7 +584,7 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
this.onRoomUpdate(room);
}
}
}
};
private onAccountData = (ev: MatrixEvent, lastEvent: MatrixEvent) => {
if (ev.getType() === EventType.Direct) {

View file

@ -58,7 +58,7 @@ export default class ThreepidInviteStore extends EventEmitter {
}
public storeInvite(roomId: string, wireInvite: IThreepidInviteWireFormat): IThreepidInvite {
const invite = <IPersistedThreepidInvite>{roomId, ...wireInvite};
const invite = <IPersistedThreepidInvite>{ roomId, ...wireInvite };
const id = this.generateIdOf(invite);
localStorage.setItem(`${STORAGE_PREFIX}${id}`, JSON.stringify(invite));
return this.translateInvite(invite);

View file

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import {MatrixClientPeg} from "../MatrixClientPeg";
import { MatrixClientPeg } from "../MatrixClientPeg";
import SettingsStore from "../settings/SettingsStore";
import Timer from "../utils/Timer";

View file

@ -106,7 +106,7 @@ export default class UIStore extends EventEmitter {
});
this.emit(UI_EVENTS.Resize, entries);
}
};
}
window.mxUIStore = UIStore.instance;

View file

@ -14,10 +14,10 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import {AsyncStoreWithClient} from "./AsyncStoreWithClient";
import { AsyncStoreWithClient } from "./AsyncStoreWithClient";
import defaultDispatcher from "../dispatcher/dispatcher";
import {ActionPayload} from "../dispatcher/payloads";
import {VoiceRecording} from "../voice/VoiceRecording";
import { ActionPayload } from "../dispatcher/payloads";
import { VoiceRecording } from "../voice/VoiceRecording";
interface IState {
recording?: VoiceRecording;
@ -62,7 +62,7 @@ export class VoiceRecordingStore extends AsyncStoreWithClient<IState> {
const recording = new VoiceRecording(this.matrixClient);
// noinspection JSIgnoredPromiseFromCall - we can safely run this async
this.updateState({recording});
this.updateState({ recording });
return recording;
}
@ -75,7 +75,7 @@ export class VoiceRecordingStore extends AsyncStoreWithClient<IState> {
if (this.state.recording) {
this.state.recording.destroy(); // stops internally
}
return this.updateState({recording: null});
return this.updateState({ recording: null });
}
}

View file

@ -24,8 +24,8 @@ import defaultDispatcher from "../dispatcher/dispatcher";
import WidgetEchoStore from "../stores/WidgetEchoStore";
import ActiveWidgetStore from "../stores/ActiveWidgetStore";
import WidgetUtils from "../utils/WidgetUtils";
import {WidgetType} from "../widgets/WidgetType";
import {UPDATE_EVENT} from "./AsyncStore";
import { WidgetType } from "../widgets/WidgetType";
import { UPDATE_EVENT } from "./AsyncStore";
import { MatrixClientPeg } from "../MatrixClientPeg";
interface IState {}

View file

@ -77,10 +77,10 @@ export class EchoStore extends AsyncStoreWithClient<IState> {
if (hasOrHadError && !this.state.toastRef) {
const ref = NonUrgentToastStore.instance.addToast(NonUrgentEchoFailureToast);
await this.updateState({toastRef: ref});
await this.updateState({ toastRef: ref });
} else if (!hasOrHadError && this.state.toastRef) {
NonUrgentToastStore.instance.removeToast(this.state.toastRef);
await this.updateState({toastRef: null});
await this.updateState({ toastRef: null });
}
}

View file

@ -53,7 +53,7 @@ export abstract class GenericEchoChamber<C extends EchoContext, K, V> extends Ev
}
private cacheVal(key: K, val: V, txn: EchoTransaction) {
this.cache.set(key, {txn, val});
this.cache.set(key, { txn, val });
this.emit(PROPERTY_UPDATED, key);
}

View file

@ -80,8 +80,8 @@ export class NotificationStateSnapshot {
}
public isDifferentFrom(other: NotificationState): boolean {
const before = {count: this.count, symbol: this.symbol, color: this.color};
const after = {count: other.count, symbol: other.symbol, color: other.color};
const before = { count: this.count, symbol: this.symbol, color: this.color };
const after = { count: other.count, symbol: other.symbol, color: other.color };
return JSON.stringify(before) !== JSON.stringify(after);
}
}

View file

@ -176,7 +176,7 @@ export class MessagePreviewStore extends AsyncStoreWithClient<IState> {
if (payload.action === 'MatrixActions.Room.timeline' || payload.action === 'MatrixActions.Event.decrypted') {
const event = payload.event; // TODO: Type out the dispatcher
const isHistoricalEvent = payload.hasOwnProperty("isLiveEvent") && !payload.isLiveEvent
const isHistoricalEvent = payload.hasOwnProperty("isLiveEvent") && !payload.isLiveEvent;
if (!this.previews.has(event.getRoomId()) || isHistoricalEvent) return; // not important
await this.generatePreview(this.matrixClient.getRoom(event.getRoomId()), TAG_ANY);
}

View file

@ -14,27 +14,27 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import {MatrixClient} from "matrix-js-sdk/src/client";
import { MatrixClient } from "matrix-js-sdk/src/client";
import SettingsStore from "../../settings/SettingsStore";
import {DefaultTagID, isCustomTag, OrderedDefaultTagIDs, RoomUpdateCause, TagID} from "./models";
import {Room} from "matrix-js-sdk/src/models/room";
import {IListOrderingMap, ITagMap, ITagSortingMap, ListAlgorithm, SortAlgorithm} from "./algorithms/models";
import {ActionPayload} from "../../dispatcher/payloads";
import { DefaultTagID, isCustomTag, OrderedDefaultTagIDs, RoomUpdateCause, TagID } from "./models";
import { Room } from "matrix-js-sdk/src/models/room";
import { IListOrderingMap, ITagMap, ITagSortingMap, ListAlgorithm, SortAlgorithm } from "./algorithms/models";
import { ActionPayload } from "../../dispatcher/payloads";
import defaultDispatcher from "../../dispatcher/dispatcher";
import {readReceiptChangeIsFor} from "../../utils/read-receipts";
import {FILTER_CHANGED, FilterKind, IFilterCondition} from "./filters/IFilterCondition";
import {TagWatcher} from "./TagWatcher";
import { readReceiptChangeIsFor } from "../../utils/read-receipts";
import { FILTER_CHANGED, FilterKind, IFilterCondition } from "./filters/IFilterCondition";
import { TagWatcher } from "./TagWatcher";
import RoomViewStore from "../RoomViewStore";
import {Algorithm, LIST_UPDATED_EVENT} from "./algorithms/Algorithm";
import {EffectiveMembership, getEffectiveMembership} from "../../utils/membership";
import {isNullOrUndefined} from "matrix-js-sdk/src/utils";
import { Algorithm, LIST_UPDATED_EVENT } from "./algorithms/Algorithm";
import { EffectiveMembership, getEffectiveMembership } from "../../utils/membership";
import { isNullOrUndefined } from "matrix-js-sdk/src/utils";
import RoomListLayoutStore from "./RoomListLayoutStore";
import {MarkedExecution} from "../../utils/MarkedExecution";
import {AsyncStoreWithClient} from "../AsyncStoreWithClient";
import {NameFilterCondition} from "./filters/NameFilterCondition";
import {RoomNotificationStateStore} from "../notifications/RoomNotificationStateStore";
import {VisibilityProvider} from "./filters/VisibilityProvider";
import {SpaceWatcher} from "./SpaceWatcher";
import { MarkedExecution } from "../../utils/MarkedExecution";
import { AsyncStoreWithClient } from "../AsyncStoreWithClient";
import { NameFilterCondition } from "./filters/NameFilterCondition";
import { RoomNotificationStateStore } from "../notifications/RoomNotificationStateStore";
import { VisibilityProvider } from "./filters/VisibilityProvider";
import { SpaceWatcher } from "./SpaceWatcher";
interface IState {
tagsEnabled?: boolean;
@ -130,8 +130,8 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> {
// Update any settings here, as some may have happened before we were logically ready.
console.log("Regenerating room lists: Startup");
await this.readAndCacheSettingsFromStore();
await this.regenerateAllLists({trigger: false});
await this.handleRVSUpdate({trigger: false}); // fake an RVS update to adjust sticky room, if needed
await this.regenerateAllLists({ trigger: false });
await this.handleRVSUpdate({ trigger: false }); // fake an RVS update to adjust sticky room, if needed
this.updateFn.mark(); // we almost certainly want to trigger an update.
this.updateFn.trigger();
@ -156,7 +156,7 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> {
* @param trigger Set to false to prevent a list update from being sent. Should only
* be used if the calling code will manually trigger the update.
*/
private async handleRVSUpdate({trigger = true}) {
private async handleRVSUpdate({ trigger = true }) {
if (!this.matrixClient) return; // We assume there won't be RVS updates without a client
const activeRoomId = RoomViewStore.getRoomId();
@ -224,7 +224,7 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> {
console.log("Regenerating room lists: Settings changed");
await this.readAndCacheSettingsFromStore();
await this.regenerateAllLists({trigger: false}); // regenerate the lists now
await this.regenerateAllLists({ trigger: false }); // regenerate the lists now
this.updateFn.trigger();
}
}
@ -632,7 +632,7 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> {
* @param trigger Set to false to prevent a list update from being sent. Should only
* be used if the calling code will manually trigger the update.
*/
public async regenerateAllLists({trigger = true}) {
public async regenerateAllLists({ trigger = true }) {
console.warn("Regenerating all room lists");
const rooms = this.getPlausibleRooms();

View file

@ -46,7 +46,7 @@ export class NameFilterCondition extends EventEmitter implements IFilterConditio
private callUpdate = throttle(() => {
this.emit(FILTER_CHANGED);
}, 200, {trailing: true, leading: true});
}, 200, { trailing: true, leading: true });
public isVisible(room: Room): boolean {
const lcFilter = this.search.toLowerCase();

View file

@ -14,7 +14,7 @@
* limitations under the License.
*/
import {Room} from "matrix-js-sdk/src/models/room";
import { Room } from "matrix-js-sdk/src/models/room";
import CallHandler from "../../../CallHandler";
import { RoomListCustomisations } from "../../../customisations/RoomList";
import VoipUserMapper from "../../../VoipUserMapper";

View file

@ -26,7 +26,7 @@ export class CallAnswerEventPreview implements IPreview {
if (isSelf(event)) {
return _t("You joined the call");
} else {
return _t("%(senderName)s joined the call", {senderName: getSenderName(event)});
return _t("%(senderName)s joined the call", { senderName: getSenderName(event) });
}
} else {
return _t("Call in progress");

View file

@ -26,7 +26,7 @@ export class CallHangupEvent implements IPreview {
if (isSelf(event)) {
return _t("You ended the call");
} else {
return _t("%(senderName)s ended the call", {senderName: getSenderName(event)});
return _t("%(senderName)s ended the call", { senderName: getSenderName(event) });
}
} else {
return _t("Call ended");

View file

@ -26,13 +26,13 @@ export class CallInviteEventPreview implements IPreview {
if (isSelf(event)) {
return _t("You started a call");
} else {
return _t("%(senderName)s started a call", {senderName: getSenderName(event)});
return _t("%(senderName)s started a call", { senderName: getSenderName(event) });
}
} else {
if (isSelf(event)) {
return _t("Waiting for answer");
} else {
return _t("%(senderName)s is calling", {senderName: getSenderName(event)});
return _t("%(senderName)s is calling", { senderName: getSenderName(event) });
}
}
}

View file

@ -59,13 +59,13 @@ export class MessageEventPreview implements IPreview {
}
if (msgtype === 'm.emote') {
return _t("* %(senderName)s %(emote)s", {senderName: getSenderName(event), emote: body});
return _t("* %(senderName)s %(emote)s", { senderName: getSenderName(event), emote: body });
}
if (isSelf(event) || !shouldPrefixMessagesIn(event.getRoomId(), tagId)) {
return body;
} else {
return _t("%(senderName)s: %(message)s", {senderName: getSenderName(event), message: body});
return _t("%(senderName)s: %(message)s", { senderName: getSenderName(event), message: body });
}
}
}

View file

@ -44,7 +44,7 @@ export class ReactionEventPreview implements IPreview {
if (isSelf(event) || !shouldPrefixMessagesIn(event.getRoomId(), tagId)) {
return reaction;
} else {
return _t("%(senderName)s: %(reaction)s", {senderName: getSenderName(event), reaction});
return _t("%(senderName)s: %(reaction)s", { senderName: getSenderName(event), reaction });
}
}
}

View file

@ -28,7 +28,7 @@ export class StickerEventPreview implements IPreview {
if (isSelf(event) || !shouldPrefixMessagesIn(event.getRoomId(), tagId)) {
return stickerName;
} else {
return _t("%(senderName)s: %(stickerName)s", {senderName: getSenderName(event), stickerName});
return _t("%(senderName)s: %(stickerName)s", { senderName: getSenderName(event), stickerName });
}
}
}

View file

@ -46,9 +46,9 @@ import ActiveWidgetStore from "../ActiveWidgetStore";
import { objectShallowClone } from "../../utils/objects";
import defaultDispatcher from "../../dispatcher/dispatcher";
import { ElementWidgetActions, IViewRoomApiRequest } from "./ElementWidgetActions";
import {ModalWidgetStore} from "../ModalWidgetStore";
import { ModalWidgetStore } from "../ModalWidgetStore";
import ThemeWatcher from "../../settings/watchers/ThemeWatcher";
import {getCustomTheme} from "../../theme";
import { getCustomTheme } from "../../theme";
import CountlyAnalytics from "../../CountlyAnalytics";
import { ElementWidgetCapabilities } from "./ElementWidgetCapabilities";
import { MatrixEvent, IEvent } from "matrix-js-sdk/src/models/event";
@ -180,17 +180,17 @@ export class StopGapWidget extends EventEmitter {
* The URL to use in the iframe
*/
public get embedUrl(): string {
return this.runUrlTemplate({asPopout: false});
return this.runUrlTemplate({ asPopout: false });
}
/**
* The URL to use in the popout
*/
public get popoutUrl(): string {
return this.runUrlTemplate({asPopout: true});
return this.runUrlTemplate({ asPopout: true });
}
private runUrlTemplate(opts = {asPopout: false}): string {
private runUrlTemplate(opts = { asPopout: false }): string {
const templated = this.mockWidget.getCompleteUrl({
widgetRoomId: this.roomId,
currentUserId: MatrixClientPeg.get().getUserId(),
@ -244,7 +244,7 @@ export class StopGapWidget extends EventEmitter {
error: {
message: "Unable to open modal at this time",
},
})
});
}
};
@ -270,14 +270,14 @@ export class StopGapWidget extends EventEmitter {
const targetRoomId = (ev.detail.data || {}).room_id;
if (!targetRoomId) {
return this.messaging.transport.reply(ev.detail, <IWidgetApiErrorResponseData>{
error: {message: "Room ID not supplied."},
error: { message: "Room ID not supplied." },
});
}
// Check the widget's permission
if (!this.messaging.hasCapability(ElementWidgetCapabilities.CanChangeViewedRoom)) {
return this.messaging.transport.reply(ev.detail, <IWidgetApiErrorResponseData>{
error: {message: "This widget does not have permission for this action (denied)."},
error: { message: "This widget does not have permission for this action (denied)." },
});
}
@ -335,12 +335,12 @@ export class StopGapWidget extends EventEmitter {
this.messaging.transport.reply(ev.detail, <IWidgetApiRequestEmptyData>{});
// First close the stickerpicker
defaultDispatcher.dispatch({action: "stickerpicker_close"});
defaultDispatcher.dispatch({ action: "stickerpicker_close" });
// Now open the integration manager
// TODO: Spec this interaction.
const data = ev.detail.data;
const integType = data?.integType
const integType = data?.integType;
const integId = <string>data?.integId;
// TODO: Open the right integration manager for the widget
@ -384,7 +384,7 @@ export class StopGapWidget extends EventEmitter {
}
}
public stop(opts = {forceDestroy: false}) {
public stop(opts = { forceDestroy: false }) {
if (!opts?.forceDestroy && ActiveWidgetStore.getPersistentWidgetId() === this.mockWidget.id) {
console.log("Skipping destroy - persistent widget");
return;

View file

@ -43,8 +43,8 @@ import { EventType } from "matrix-js-sdk/src/@types/event";
import { CHAT_EFFECTS } from "../../effects";
import { containsEmoji } from "../../effects/utils";
import dis from "../../dispatcher/dispatcher";
import {tryTransformPermalinkToLocalHref} from "../../utils/permalinks/Permalinks";
import {MatrixEvent} from "matrix-js-sdk/src/models/event";
import { tryTransformPermalinkToLocalHref } from "../../utils/permalinks/Permalinks";
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
// TODO: Purge this from the universe
@ -136,13 +136,13 @@ export class StopGapWidgetDriver extends WidgetDriver {
if (eventType === EventType.RoomMessage) {
CHAT_EFFECTS.forEach((effect) => {
if (containsEmoji(content, effect.emojis)) {
dis.dispatch({action: `effects.${effect.command}`});
dis.dispatch({ action: `effects.${effect.command}` });
}
});
}
}
return {roomId, eventId: r.event_id};
return { roomId, eventId: r.event_id };
}
public async readRoomEvents(eventType: string, msgtype: string | undefined, limit: number): Promise<object[]> {
@ -199,13 +199,13 @@ export class StopGapWidgetDriver extends WidgetDriver {
};
if (oidcState === OIDCState.Denied) {
return observer.update({state: OpenIDRequestState.Blocked});
return observer.update({ state: OpenIDRequestState.Blocked });
}
if (oidcState === OIDCState.Allowed) {
return observer.update({state: OpenIDRequestState.Allowed, token: await getToken()});
return observer.update({ state: OpenIDRequestState.Allowed, token: await getToken() });
}
observer.update({state: OpenIDRequestState.PendingUserConfirmation});
observer.update({ state: OpenIDRequestState.PendingUserConfirmation });
Modal.createTrackedDialog("OpenID widget permissions", '', WidgetOpenIDPermissionsDialog, {
widget: this.forWidget,
@ -214,10 +214,10 @@ export class StopGapWidgetDriver extends WidgetDriver {
onFinished: async (confirm) => {
if (!confirm) {
return observer.update({state: OpenIDRequestState.Blocked});
return observer.update({ state: OpenIDRequestState.Blocked });
}
return observer.update({state: OpenIDRequestState.Allowed, token: await getToken()});
return observer.update({ state: OpenIDRequestState.Allowed, token: await getToken() });
},
});
}

View file

@ -425,7 +425,7 @@ export class WidgetLayoutStore extends ReadyWatchingStore {
const allWidgets = this.getAllWidgets(room);
if (!allWidgets.some(([w])=> w.id === widget.id)) return; // invalid
this.updateUserLayout(room, {
[widget.id]: {container: toContainer},
[widget.id]: { container: toContainer },
});
}
@ -436,9 +436,9 @@ export class WidgetLayoutStore extends ReadyWatchingStore {
public copyLayoutToRoom(room: Room) {
const allWidgets = this.getAllWidgets(room);
const evContent: ILayoutStateEvent = {widgets: {}};
const evContent: ILayoutStateEvent = { widgets: {} };
for (const [widget, container] of allWidgets) {
evContent.widgets[widget.id] = {container};
evContent.widgets[widget.id] = { container };
if (container === Container.Top) {
const containerWidgets = this.getContainerWidgets(room, container);
const idx = containerWidgets.findIndex(w => w.id === widget.id);