fix: don't display message preview of thread (#31043)

This commit is contained in:
Florian Duros
2025-10-20 16:35:57 +02:00
committed by GitHub
parent cbcceee970
commit 8fd6e29f2d

View File

@@ -31,6 +31,7 @@ import { ReactionEventPreview } from "./previews/ReactionEventPreview";
import { UPDATE_EVENT } from "../AsyncStore";
import { type IPreview } from "./previews/IPreview";
import shouldHideEvent from "../../shouldHideEvent";
import SettingsStore from "../../settings/SettingsStore";
// Emitted event for when a room's preview has changed. First argument will the room for which
// the change happened.
@@ -178,11 +179,14 @@ export class MessagePreviewStore extends AsyncStoreWithClient<EmptyObject> {
private async generatePreview(room: Room, tagId?: TagID): Promise<void> {
const events = [...room.getLiveTimeline().getEvents(), ...room.getPendingEvents()];
// add last reply from each thread
room.getThreads().forEach((thread: Thread): void => {
const lastReply = thread.lastReply();
if (lastReply) events.push(lastReply);
});
const isNewRoomListEnabled = SettingsStore.getValue("feature_new_room_list");
if (!isNewRoomListEnabled) {
// add last reply from each thread
room.getThreads().forEach((thread: Thread): void => {
const lastReply = thread.lastReply();
if (lastReply) events.push(lastReply);
});
}
// sort events from oldest to newest
events.sort((a: MatrixEvent, b: MatrixEvent) => {