MM-35017: participants ordering and inclusion (#5654)

Participants no longer include the thread starter,
thread starter is included only if the user has replied.

This commit changes the ordering of participants to reverse so that the
latest replier is placed first and so forth.

Also the thread starter is not included in the channel view, but is
included in the global threads view.
This commit is contained in:
Kyriakos Z 2021-09-02 00:26:53 +03:00 committed by GitHub
parent c6cf1f480d
commit 8a2a45fd74
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 7 deletions

View file

@ -19,7 +19,7 @@ exports[`Global Thread Footer Should render for channel view and unfollow the th
}
userIds={
Array [
"user1",
"user2",
]
}
/>
@ -99,6 +99,7 @@ exports[`Global Thread Footer Should render for global threads view 1`] = `
userIds={
Array [
"user1",
"user2",
]
}
/>

View file

@ -28,7 +28,7 @@ describe('Global Thread Footer', () => {
thread: {
id: 'thread1',
participants: [{
id: 'user1',
id: 'user2',
}],
is_following: true,
reply_count: 2,

View file

@ -133,15 +133,13 @@ function ThreadFooter({actions, currentUserId, intl, location, testID, theme, th
// threadstarter should be the first one in the avatars list
const participants = React.useMemo(() => {
if (thread.participants?.length) {
let isThreadStarterFound = false;
const participantIds = thread.participants.flatMap((participant) => {
if (participant.id === threadStarter?.id) {
isThreadStarterFound = true;
if (location === GLOBAL_THREADS && participant.id === threadStarter?.id) {
return [];
}
return participant.id;
});
if (isThreadStarterFound) {
}).reverse();
if (location === GLOBAL_THREADS) {
participantIds.unshift(threadStarter?.id);
}
return participantIds;