Skip to content

Commit 8fd6e29

Browse files
authored
fix: don't display message preview of thread (#31043)
1 parent cbcceee commit 8fd6e29

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/stores/room-list/MessagePreviewStore.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import { ReactionEventPreview } from "./previews/ReactionEventPreview";
3131
import { UPDATE_EVENT } from "../AsyncStore";
3232
import { type IPreview } from "./previews/IPreview";
3333
import shouldHideEvent from "../../shouldHideEvent";
34+
import SettingsStore from "../../settings/SettingsStore";
3435

3536
// Emitted event for when a room's preview has changed. First argument will the room for which
3637
// the change happened.
@@ -178,11 +179,14 @@ export class MessagePreviewStore extends AsyncStoreWithClient<EmptyObject> {
178179
private async generatePreview(room: Room, tagId?: TagID): Promise<void> {
179180
const events = [...room.getLiveTimeline().getEvents(), ...room.getPendingEvents()];
180181

181-
// add last reply from each thread
182-
room.getThreads().forEach((thread: Thread): void => {
183-
const lastReply = thread.lastReply();
184-
if (lastReply) events.push(lastReply);
185-
});
182+
const isNewRoomListEnabled = SettingsStore.getValue("feature_new_room_list");
183+
if (!isNewRoomListEnabled) {
184+
// add last reply from each thread
185+
room.getThreads().forEach((thread: Thread): void => {
186+
const lastReply = thread.lastReply();
187+
if (lastReply) events.push(lastReply);
188+
});
189+
}
186190

187191
// sort events from oldest to newest
188192
events.sort((a: MatrixEvent, b: MatrixEvent) => {

0 commit comments

Comments
 (0)