Don't form continuations from thread roots (#8166)

* Don't form continuations from thread roots

* Only apply the continuation break in the main timeline
This commit is contained in:
Robin 2022-03-26 18:06:25 -04:00 committed by GitHub
parent 6c69f3e3b6
commit 1e060fed84
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 62 additions and 11 deletions

View file

@ -23,6 +23,7 @@ import { EventType, MsgType } from "matrix-js-sdk/src/@types/event";
import { logger } from "matrix-js-sdk/src/logger";
import Exporter from "./Exporter";
import SettingsStore from "../../settings/SettingsStore";
import { mediaFromMxc } from "../../customisations/Media";
import { Layout } from "../../settings/enums/Layout";
import { shouldFormContinuation } from "../../components/structures/MessagePanel";
@ -46,6 +47,7 @@ export default class HTMLExporter extends Exporter {
protected permalinkCreator: RoomPermalinkCreator;
protected totalSize: number;
protected mediaOmitText: string;
private threadsEnabled: boolean;
constructor(
room: Room,
@ -60,6 +62,7 @@ export default class HTMLExporter extends Exporter {
this.mediaOmitText = !this.exportOptions.attachmentsIncluded
? _t("Media omitted")
: _t("Media omitted - file size limit exceeded");
this.threadsEnabled = SettingsStore.getValue("feature_thread");
}
protected async getRoomAvatar() {
@ -406,8 +409,8 @@ export default class HTMLExporter extends Exporter {
if (!haveTileForEvent(event)) continue;
content += this.needsDateSeparator(event, prevEvent) ? this.getDateSeparator(event) : "";
const shouldBeJoined = !this.needsDateSeparator(event, prevEvent)
&& shouldFormContinuation(prevEvent, event, false);
const shouldBeJoined = !this.needsDateSeparator(event, prevEvent) &&
shouldFormContinuation(prevEvent, event, false, this.threadsEnabled);
const body = await this.createMessageBody(event, shouldBeJoined);
this.totalSize += Buffer.byteLength(body);
content += body;