Fix type lint

This commit is contained in:
Jaiwanth 2021-06-22 09:27:49 +05:30
parent 45be4a6d02
commit a0e0453635

View file

@ -217,7 +217,7 @@ export default class HTMLExporter extends Exporter {
this.avatars.set(member.userId, true); this.avatars.set(member.userId, true);
const image = await fetch(avatarUrl); const image = await fetch(avatarUrl);
const blob = await image.blob(); const blob = await image.blob();
this.zip.file(`users/${member.userId}`, blob); this.zip.file(`users/${member.userId.replace(/:/g, '-')}`, blob);
} }
} }
@ -265,7 +265,10 @@ export default class HTMLExporter extends Exporter {
let eventTileMarkup = renderToStaticMarkup(eventTile); let eventTileMarkup = renderToStaticMarkup(eventTile);
if (filePath) eventTileMarkup = eventTileMarkup.replace(/(src=|href=)"forExport"/g, `$1"${filePath}"`); if (filePath) eventTileMarkup = eventTileMarkup.replace(/(src=|href=)"forExport"/g, `$1"${filePath}"`);
if (hasAvatar) { if (hasAvatar) {
eventTileMarkup = eventTileMarkup.replace(/src="AvatarForExport"/g, `src="users/${mxEv.sender.userId}"`); eventTileMarkup = eventTileMarkup.replace(
/src="avatarForExport"/g,
`src="users/${mxEv.sender.userId.replace(/:/g, "-")}"`,
);
} }
return eventTileMarkup; return eventTileMarkup;
} }
@ -286,18 +289,16 @@ export default class HTMLExporter extends Exporter {
} else { } else {
const modifiedContent = { const modifiedContent = {
msgtype: "m.text", msgtype: "m.text",
body: `**${this.mediaOmitText}**`, body: `*${this.mediaOmitText}*`,
format: "org.matrix.custom.html", format: "org.matrix.custom.html",
formatted_body: `<strong>${this.mediaOmitText}</strong>`, formatted_body: `<em>${this.mediaOmitText}</em>`,
} }
if (mxEv.isEncrypted()) { const modifiedEvent = new MatrixEvent();
mxEv._clearEvent.content = modifiedContent; modifiedEvent.event = mxEv.event;
mxEv._clearEvent.type = "m.room.message"; modifiedEvent.sender = mxEv.sender;
} else { modifiedEvent.event.type = "m.room.message";
mxEv.event.content = modifiedContent; modifiedEvent.event.content = modifiedContent;
mxEv.event.type = "m.room.message"; eventTile = await this.getEventTile(modifiedEvent, joined);
}
eventTile = await this.getEventTile(mxEv, joined);
} }
} else eventTile = await this.getEventTile(mxEv, joined); } else eventTile = await this.getEventTile(mxEv, joined);