1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-07-30 02:21:17 +03:00

Refactor pill and add tests (#10304)

This commit is contained in:
Michael Weimann
2023-03-08 13:06:50 +01:00
committed by GitHub
parent c0e40217f3
commit ad26925bb6
10 changed files with 653 additions and 275 deletions

View File

@ -679,12 +679,13 @@ export const mkSpace = (
return space;
};
export const mkRoomMemberJoinEvent = (user: string, room: string): MatrixEvent => {
export const mkRoomMemberJoinEvent = (user: string, room: string, content?: IContent): MatrixEvent => {
return mkEvent({
event: true,
type: EventType.RoomMember,
content: {
membership: "join",
...content,
},
skey: user,
user,
@ -692,6 +693,19 @@ export const mkRoomMemberJoinEvent = (user: string, room: string): MatrixEvent =
});
};
export const mkRoomCanonicalAliasEvent = (userId: string, roomId: string, alias: string): MatrixEvent => {
return mkEvent({
event: true,
type: EventType.RoomCanonicalAlias,
content: {
alias,
},
skey: "",
user: userId,
room: roomId,
});
};
export const mkThirdPartyInviteEvent = (user: string, displayName: string, room: string): MatrixEvent => {
return mkEvent({
event: true,