Handle reply checking for encrypted messages
This commit is contained in:
parent
16c55ba92f
commit
cea60ef26c
1 changed files with 11 additions and 12 deletions
|
@ -175,7 +175,7 @@ pre {
|
||||||
|
|
||||||
.page_body {
|
.page_body {
|
||||||
padding-top: 64px;
|
padding-top: 64px;
|
||||||
width: 480px;
|
width: 700px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,7 +239,6 @@ div.selected {
|
||||||
}
|
}
|
||||||
|
|
||||||
.default .from_name {
|
.default .from_name {
|
||||||
color: #3892db;
|
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
padding-bottom: 5px;
|
padding-bottom: 5px;
|
||||||
}
|
}
|
||||||
|
@ -336,10 +335,13 @@ const createMessageBody = (event, joined = false, isReply = false, replyId = nul
|
||||||
`;
|
`;
|
||||||
};
|
};
|
||||||
|
|
||||||
const replyId = (event) => {
|
|
||||||
const relatesTo = event.getContent()["m.relates_to"];
|
const baseEventId = (event) => {
|
||||||
const replyId = relatesTo ? relatesTo["m.in_reply_to"].event_id : null;
|
const isEncrypted = event.isEncrypted();
|
||||||
return replyId;
|
// If encrypted, in_reply_to lies in event.event.content
|
||||||
|
const content = isEncrypted ? event.event.content : event.getContent();
|
||||||
|
const relatesTo = content["m.relates_to"];
|
||||||
|
return relatesTo ? relatesTo["m.in_reply_to"].event_id : null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -365,11 +367,10 @@ const createHTML = (events, room) => {
|
||||||
for (const event of events) {
|
for (const event of events) {
|
||||||
content += dateSeparator(event, prevEvent);
|
content += dateSeparator(event, prevEvent);
|
||||||
if (event.getType() === "m.room.message") {
|
if (event.getType() === "m.room.message") {
|
||||||
|
const replyTo = baseEventId(event);
|
||||||
const shouldBeJoined = prevEvent && prevEvent.getContent().msgtype === "m.text"
|
const shouldBeJoined = prevEvent && prevEvent.getContent().msgtype === "m.text"
|
||||||
&& event.sender.userId === prevEvent.sender.userId && !dateSeparator(event, prevEvent);
|
&& event.sender.userId === prevEvent.sender.userId && !dateSeparator(event, prevEvent) && !replyTo;
|
||||||
|
const body = createMessageBody(event, shouldBeJoined, !!replyTo, replyTo);
|
||||||
const body = createMessageBody(event, shouldBeJoined, !!replyId(event), replyId(event));
|
|
||||||
|
|
||||||
content += body;
|
content += body;
|
||||||
} else {
|
} else {
|
||||||
content += `
|
content += `
|
||||||
|
@ -395,9 +396,7 @@ const exportConversationalHistory = async (room) => {
|
||||||
const filename = `matrix-export-${new Date().toISOString()}.zip`;
|
const filename = `matrix-export-${new Date().toISOString()}.zip`;
|
||||||
|
|
||||||
//Generate the zip file asynchronously
|
//Generate the zip file asynchronously
|
||||||
|
|
||||||
const blob = await zip.generateAsync({ type: "blob" });
|
const blob = await zip.generateAsync({ type: "blob" });
|
||||||
|
|
||||||
//Create a writable stream to the directory
|
//Create a writable stream to the directory
|
||||||
const fileStream = streamSaver.createWriteStream(filename, blob.size);
|
const fileStream = streamSaver.createWriteStream(filename, blob.size);
|
||||||
const writer = fileStream.getWriter();
|
const writer = fileStream.getWriter();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue