Pillify event permalinks (#10392)
This commit is contained in:
parent
d8acdd1750
commit
96d1b74ffc
19 changed files with 742 additions and 144 deletions
|
@ -255,6 +255,8 @@ type MakeEventPassThruProps = {
|
|||
skey?: string;
|
||||
};
|
||||
type MakeEventProps = MakeEventPassThruProps & {
|
||||
/** If provided will be used as event Id. Else an Id is generated. */
|
||||
id?: string;
|
||||
type: string;
|
||||
redacts?: string;
|
||||
content: IContent;
|
||||
|
@ -301,7 +303,7 @@ export function mkEvent(opts: MakeEventProps): MatrixEvent {
|
|||
sender: opts.user,
|
||||
content: opts.content,
|
||||
prev_content: opts.prev_content,
|
||||
event_id: "$" + Math.random() + "-" + Math.random(),
|
||||
event_id: opts.id ?? "$" + Math.random() + "-" + Math.random(),
|
||||
origin_server_ts: opts.ts ?? 0,
|
||||
unsigned: opts.unsigned,
|
||||
redacts: opts.redacts,
|
||||
|
@ -483,12 +485,13 @@ export function mkMessage({
|
|||
formattedMsg,
|
||||
relatesTo,
|
||||
...opts
|
||||
}: MakeEventPassThruProps & {
|
||||
room: Room["roomId"];
|
||||
msg?: string;
|
||||
format?: string;
|
||||
formattedMsg?: string;
|
||||
}): MatrixEvent {
|
||||
}: MakeEventPassThruProps &
|
||||
Pick<MakeEventProps, "id"> & {
|
||||
room: Room["roomId"];
|
||||
msg?: string;
|
||||
format?: string;
|
||||
formattedMsg?: string;
|
||||
}): MatrixEvent {
|
||||
if (!opts.room || !opts.user) {
|
||||
throw new Error("Missing .room or .user from options");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue