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