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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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,