Use EventType at the state and account data call sites. [skip build]
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import {
|
||||
Direction,
|
||||
EventTimeline,
|
||||
EventType,
|
||||
IContextResponse,
|
||||
MatrixClient,
|
||||
Method,
|
||||
@@ -9,7 +10,7 @@ import {
|
||||
RoomMember,
|
||||
Visibility,
|
||||
} from 'matrix-js-sdk';
|
||||
import { RoomServerAclEventContent } from 'matrix-js-sdk/lib/types';
|
||||
import { RoomMemberEventContent, RoomServerAclEventContent } from 'matrix-js-sdk/lib/types';
|
||||
import { useMemo } from 'react';
|
||||
import {
|
||||
addRoomIdToMDirect,
|
||||
@@ -363,11 +364,11 @@ export const useCommands = (mx: MatrixClient, room: Room): CommandRecord => {
|
||||
.getLiveTimeline()
|
||||
.getState(EventTimeline.FORWARDS)
|
||||
?.getStateEvents(StateEvent.RoomMember, mx.getSafeUserId());
|
||||
const content = mEvent?.getContent();
|
||||
const content = mEvent?.getContent<RoomMemberEventContent>();
|
||||
if (!content) return;
|
||||
await mx.sendStateEvent(
|
||||
room.roomId,
|
||||
StateEvent.RoomMember as any,
|
||||
EventType.RoomMember,
|
||||
{
|
||||
...content,
|
||||
displayname: nick,
|
||||
@@ -385,11 +386,11 @@ export const useCommands = (mx: MatrixClient, room: Room): CommandRecord => {
|
||||
.getLiveTimeline()
|
||||
.getState(EventTimeline.FORWARDS)
|
||||
?.getStateEvents(StateEvent.RoomMember, mx.getSafeUserId());
|
||||
const content = mEvent?.getContent();
|
||||
const content = mEvent?.getContent<RoomMemberEventContent>();
|
||||
if (!content) return;
|
||||
await mx.sendStateEvent(
|
||||
room.roomId,
|
||||
StateEvent.RoomMember as any,
|
||||
EventType.RoomMember,
|
||||
{
|
||||
...content,
|
||||
avatar_url: payload,
|
||||
@@ -529,7 +530,7 @@ export const useCommands = (mx: MatrixClient, room: Room): CommandRecord => {
|
||||
aclContent.allow?.sort();
|
||||
aclContent.deny?.sort();
|
||||
|
||||
await mx.sendStateEvent(room.roomId, StateEvent.RoomServerAcl as any, aclContent);
|
||||
await mx.sendStateEvent(room.roomId, EventType.RoomServerAcl, aclContent);
|
||||
},
|
||||
},
|
||||
}),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useCallback, useEffect, useMemo } from 'react';
|
||||
import { MatrixError, Room } from 'matrix-js-sdk';
|
||||
import { EventType, MatrixError, Room } from 'matrix-js-sdk';
|
||||
import { RoomCanonicalAliasEventContent } from 'matrix-js-sdk/lib/types';
|
||||
import { AsyncState, useAsyncCallback } from './useAsyncCallback';
|
||||
import { useMatrixClient } from './useMatrixClient';
|
||||
@@ -56,7 +56,7 @@ export const useSetMainAlias = (room: Room): ((alias: string | undefined) => Pro
|
||||
alt_aliases: altAliases,
|
||||
};
|
||||
|
||||
await mx.sendStateEvent(room.roomId, StateEvent.RoomCanonicalAlias as any, newContent);
|
||||
await mx.sendStateEvent(room.roomId, EventType.RoomCanonicalAlias, newContent);
|
||||
},
|
||||
[mx, room],
|
||||
);
|
||||
@@ -90,7 +90,7 @@ export const usePublishUnpublishAliases = (
|
||||
alt_aliases: altAliases,
|
||||
};
|
||||
|
||||
await mx.sendStateEvent(room.roomId, StateEvent.RoomCanonicalAlias as any, newContent);
|
||||
await mx.sendStateEvent(room.roomId, EventType.RoomCanonicalAlias, newContent);
|
||||
},
|
||||
[mx, room],
|
||||
);
|
||||
@@ -114,7 +114,7 @@ export const usePublishUnpublishAliases = (
|
||||
alt_aliases: altAliases,
|
||||
};
|
||||
|
||||
await mx.sendStateEvent(room.roomId, StateEvent.RoomCanonicalAlias as any, newContent);
|
||||
await mx.sendStateEvent(room.roomId, EventType.RoomCanonicalAlias, newContent);
|
||||
},
|
||||
[mx, room],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user