소스 검색

fix(participants-pane) Place Dominant Speaker first in participants list

Move function participants list ordering function in participant-pane, since that's the only feature that uses it.
master
robertpin 4 년 전
부모
커밋
483bc45d59
No account linked to committer's email address

+ 0
- 41
react/features/base/participants/functions.js 파일 보기

@@ -455,47 +455,6 @@ async function _getFirstLoadableAvatarUrl(participant, store) {
455 455
     return undefined;
456 456
 }
457 457
 
458
-/**
459
- * Selector for retrieving ids of participants in the order that they are displayed in the filmstrip (with the
460
- * exception of participants with raised hand). The participants are reordered as follows.
461
- * 1. Local participant.
462
- * 2. Participants with raised hand.
463
- * 3. Participants with screenshare sorted alphabetically by their display name.
464
- * 4. Shared video participants.
465
- * 5. Recent speakers sorted alphabetically by their display name.
466
- * 6. Rest of the participants sorted alphabetically by their display name.
467
- *
468
- * @param {(Function|Object)} stateful - The (whole) redux state, or redux's
469
- * {@code getState} function to be used to retrieve the state features/base/participants.
470
- * @returns {Array<string>}
471
- */
472
-export function getSortedParticipantIds(stateful: Object | Function): Array<string> {
473
-    const { id } = getLocalParticipant(stateful);
474
-    const remoteParticipants = getRemoteParticipantsSorted(stateful);
475
-    const reorderedParticipants = new Set(remoteParticipants);
476
-    const raisedHandParticipants = getRaiseHandsQueue(stateful);
477
-    const remoteRaisedHandParticipants = new Set(raisedHandParticipants || []);
478
-
479
-    for (const participant of remoteRaisedHandParticipants.keys()) {
480
-        // Avoid duplicates.
481
-        if (reorderedParticipants.has(participant)) {
482
-            reorderedParticipants.delete(participant);
483
-        } else {
484
-            remoteRaisedHandParticipants.delete(participant);
485
-        }
486
-    }
487
-
488
-    // Remove self.
489
-    remoteRaisedHandParticipants.has(id) && remoteRaisedHandParticipants.delete(id);
490
-
491
-    // Move self and participants with raised hand to the top of the list.
492
-    return [
493
-        id,
494
-        ...Array.from(remoteRaisedHandParticipants.keys()),
495
-        ...Array.from(reorderedParticipants.keys())
496
-    ];
497
-}
498
-
499 458
 /**
500 459
  * Get the participants queue with raised hands.
501 460
  *

+ 2
- 3
react/features/participants-pane/components/web/MeetingParticipants.js 파일 보기

@@ -8,13 +8,12 @@ import { rejectParticipantAudio } from '../../../av-moderation/actions';
8 8
 import { isToolbarButtonEnabled } from '../../../base/config/functions.web';
9 9
 import { MEDIA_TYPE } from '../../../base/media';
10 10
 import {
11
-    getParticipantCountWithFake,
12
-    getSortedParticipantIds
11
+    getParticipantCountWithFake
13 12
 } from '../../../base/participants';
14 13
 import { connect } from '../../../base/redux';
15 14
 import { showOverflowDrawer } from '../../../toolbox/functions';
16 15
 import { muteRemote } from '../../../video-menu/actions.any';
17
-import { findStyledAncestor, shouldRenderInviteButton } from '../../functions';
16
+import { findStyledAncestor, getSortedParticipantIds, shouldRenderInviteButton } from '../../functions';
18 17
 import { useParticipantDrawer } from '../../hooks';
19 18
 
20 19
 import { InviteButton } from './InviteButton';

+ 58
- 1
react/features/participants-pane/functions.js 파일 보기

@@ -11,7 +11,10 @@ import { MEDIA_TYPE, type MediaType } from '../base/media/constants';
11 11
 import {
12 12
     getDominantSpeakerParticipant,
13 13
     isLocalParticipantModerator,
14
-    isParticipantModerator
14
+    isParticipantModerator,
15
+    getLocalParticipant,
16
+    getRemoteParticipantsSorted,
17
+    getRaiseHandsQueue
15 18
 } from '../base/participants/functions';
16 19
 import { toState } from '../base/redux';
17 20
 
@@ -188,3 +191,57 @@ export const shouldRenderInviteButton = (state: Object) => {
188 191
 
189 192
     return flagEnabled && !disableInviteFunctions;
190 193
 };
194
+
195
+/**
196
+ * Selector for retrieving ids of participants in the order that they are displayed in the filmstrip (with the
197
+ * exception of participants with raised hand). The participants are reordered as follows.
198
+ * 1. Dominant speaker.
199
+ * 2. Local participant.
200
+ * 3. Participants with raised hand.
201
+ * 4. Participants with screenshare sorted alphabetically by their display name.
202
+ * 5. Shared video participants.
203
+ * 6. Recent speakers sorted alphabetically by their display name.
204
+ * 7. Rest of the participants sorted alphabetically by their display name.
205
+ *
206
+ * @param {(Function|Object)} stateful - The (whole) redux state, or redux's
207
+ * {@code getState} function to be used to retrieve the state features/base/participants.
208
+ * @returns {Array<string>}
209
+ */
210
+export function getSortedParticipantIds(stateful: Object | Function): Array<string> {
211
+    const { id } = getLocalParticipant(stateful);
212
+    const remoteParticipants = getRemoteParticipantsSorted(stateful);
213
+    const reorderedParticipants = new Set(remoteParticipants);
214
+    const raisedHandParticipants = getRaiseHandsQueue(stateful);
215
+    const remoteRaisedHandParticipants = new Set(raisedHandParticipants || []);
216
+    const dominantSpeaker = getDominantSpeakerParticipant(stateful);
217
+
218
+    for (const participant of remoteRaisedHandParticipants.keys()) {
219
+        // Avoid duplicates.
220
+        if (reorderedParticipants.has(participant)) {
221
+            reorderedParticipants.delete(participant);
222
+        } else {
223
+            remoteRaisedHandParticipants.delete(participant);
224
+        }
225
+    }
226
+
227
+    // Remove self.
228
+    remoteRaisedHandParticipants.delete(id);
229
+
230
+    const dominant = [];
231
+
232
+    // Remove dominant speaker.
233
+    if (dominantSpeaker && dominantSpeaker.id !== id) {
234
+        remoteRaisedHandParticipants.delete(dominantSpeaker.id);
235
+        reorderedParticipants.delete(dominantSpeaker.id);
236
+        dominant.push(dominantSpeaker.id);
237
+    }
238
+
239
+    // Move self and participants with raised hand to the top of the list.
240
+    return [
241
+        ...dominant,
242
+        id,
243
+        ...Array.from(remoteRaisedHandParticipants.keys()),
244
+        ...Array.from(reorderedParticipants.keys())
245
+    ];
246
+}
247
+

Loading…
취소
저장