You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-12-07 03:42:20 +03:00
Fix 'my threads' filtering to include participated threads (#7882)
* move js utils into directory Signed-off-by: Kerry Archibald <kerrya@element.io> * typescripterize js test-utils Signed-off-by: Kerry Archibald <kerrya@element.io> * move test utils to directory Signed-off-by: Kerry Archibald <kerrya@element.io> * move remaining mock functions to directory Signed-off-by: Kerry Archibald <kerrya@element.io> * update imports Signed-off-by: Kerry Archibald <kerrya@element.io> * missed copyright Signed-off-by: Kerry Archibald <kerrya@element.io> * threads test helpers Signed-off-by: Kerry Archibald <kerrya@element.io> * forgotten copyright Signed-off-by: Kerry Archibald <kerrya@element.io> * comments Signed-off-by: Kerry Archibald <kerrya@element.io> * fix threads helper unsigned Signed-off-by: Kerry Archibald <kerrya@element.io> * test filter creation when thread capabilities enabled Signed-off-by: Kerry Archibald <kerrya@element.io>
This commit is contained in:
@@ -39,7 +39,7 @@ import { Layout } from '../../settings/enums/Layout';
|
||||
import { RoomPermalinkCreator } from '../../utils/permalinks/Permalinks';
|
||||
import Measured from '../views/elements/Measured';
|
||||
|
||||
async function getThreadTimelineSet(
|
||||
export async function getThreadTimelineSet(
|
||||
client: MatrixClient,
|
||||
room: Room,
|
||||
filterType = ThreadFilterType.All,
|
||||
@@ -89,14 +89,12 @@ async function getThreadTimelineSet(
|
||||
Array.from(room.threads)
|
||||
.sort(([, threadA], [, threadB]) => threadA.replyToEvent.getTs() - threadB.replyToEvent.getTs())
|
||||
.forEach(([, thread]) => {
|
||||
const isOwnEvent = thread.rootEvent.getSender() === client.getUserId();
|
||||
if (filterType !== ThreadFilterType.My || isOwnEvent) {
|
||||
const currentUserParticipated = thread.events.some(event => event.getSender() === client.getUserId());
|
||||
if (filterType !== ThreadFilterType.My || currentUserParticipated) {
|
||||
timelineSet.getLiveTimeline().addEvent(thread.rootEvent, false);
|
||||
}
|
||||
});
|
||||
|
||||
// for (const [, thread] of room.threads) {
|
||||
// }
|
||||
return timelineSet;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user