Use EventType at the state and account data call sites. [skip build]
This commit is contained in:
@@ -5,6 +5,7 @@ import {
|
||||
} from 'browser-encrypt-attachment';
|
||||
import {
|
||||
EventTimeline,
|
||||
EventType,
|
||||
MatrixClient,
|
||||
MatrixError,
|
||||
MatrixEvent,
|
||||
@@ -15,7 +16,6 @@ import {
|
||||
} from 'matrix-js-sdk';
|
||||
import to from 'await-to-js';
|
||||
import { IImageInfo, IThumbnailContent, IVideoInfo } from '../../types/matrix/common';
|
||||
import { AccountDataEvent } from '../../types/matrix/accountData';
|
||||
import { getStateEvent } from './room';
|
||||
import { Membership, StateEvent } from '../../types/matrix/room';
|
||||
|
||||
@@ -230,7 +230,7 @@ export const addRoomIdToMDirect = async (
|
||||
roomId: string,
|
||||
userId: string,
|
||||
): Promise<void> => {
|
||||
const mDirectsEvent = mx.getAccountData(AccountDataEvent.Direct as any);
|
||||
const mDirectsEvent = mx.getAccountData(EventType.Direct);
|
||||
let userIdToRoomIds: Record<string, string[]> = {};
|
||||
|
||||
if (typeof mDirectsEvent !== 'undefined')
|
||||
@@ -255,11 +255,11 @@ export const addRoomIdToMDirect = async (
|
||||
}
|
||||
userIdToRoomIds[userId] = roomIds;
|
||||
|
||||
await mx.setAccountData(AccountDataEvent.Direct as any, userIdToRoomIds as any);
|
||||
await mx.setAccountData(EventType.Direct, userIdToRoomIds);
|
||||
};
|
||||
|
||||
export const removeRoomIdFromMDirect = async (mx: MatrixClient, roomId: string): Promise<void> => {
|
||||
const mDirectsEvent = mx.getAccountData(AccountDataEvent.Direct as any);
|
||||
const mDirectsEvent = mx.getAccountData(EventType.Direct);
|
||||
let userIdToRoomIds: Record<string, string[]> = {};
|
||||
|
||||
if (typeof mDirectsEvent !== 'undefined')
|
||||
@@ -273,7 +273,7 @@ export const removeRoomIdFromMDirect = async (mx: MatrixClient, roomId: string):
|
||||
}
|
||||
});
|
||||
|
||||
await mx.setAccountData(AccountDataEvent.Direct as any, userIdToRoomIds as any);
|
||||
await mx.setAccountData(EventType.Direct, userIdToRoomIds);
|
||||
};
|
||||
|
||||
export const mxcUrlToHttp = (
|
||||
|
||||
Reference in New Issue
Block a user