Pillify permalinks to rooms and users (#10388)
This commit is contained in:
parent
d850c95099
commit
a86a8e7f8e
5 changed files with 128 additions and 105 deletions
|
@ -473,15 +473,21 @@ export type MessageEventProps = MakeEventPassThruProps & {
|
|||
* @param {number} opts.ts The timestamp for the event.
|
||||
* @param {boolean} opts.event True to make a MatrixEvent.
|
||||
* @param {string=} opts.msg Optional. The content.body for the event.
|
||||
* @param {string=} opts.format Optional. The content.format for the event.
|
||||
* @param {string=} opts.formattedMsg Optional. The content.formatted_body for the event.
|
||||
* @return {Object|MatrixEvent} The event
|
||||
*/
|
||||
export function mkMessage({
|
||||
msg,
|
||||
format,
|
||||
formattedMsg,
|
||||
relatesTo,
|
||||
...opts
|
||||
}: MakeEventPassThruProps & {
|
||||
room: Room["roomId"];
|
||||
msg?: string;
|
||||
format?: string;
|
||||
formattedMsg?: string;
|
||||
}): MatrixEvent {
|
||||
if (!opts.room || !opts.user) {
|
||||
throw new Error("Missing .room or .user from options");
|
||||
|
@ -493,6 +499,7 @@ export function mkMessage({
|
|||
content: {
|
||||
msgtype: "m.text",
|
||||
body: message,
|
||||
...(format && formattedMsg ? { format, formatted_body: formattedMsg } : {}),
|
||||
["m.relates_to"]: relatesTo,
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue