|
@@ -10,7 +10,7 @@ import { connect } from '../../base/redux';
|
10
|
10
|
import { escapeRegexp } from '../../base/util';
|
11
|
11
|
import { initUpdateStats, initSearch } from '../actions';
|
12
|
12
|
import { SPEAKER_STATS_RELOAD_INTERVAL } from '../constants';
|
13
|
|
-import { getSpeakerStats, getSearchCriteria } from '../functions';
|
|
13
|
+import { getSpeakerStats } from '../functions';
|
14
|
14
|
|
15
|
15
|
import SpeakerStatsItem from './SpeakerStatsItem';
|
16
|
16
|
import SpeakerStatsLabels from './SpeakerStatsLabels';
|
|
@@ -36,7 +36,7 @@ type Props = {
|
36
|
36
|
/**
|
37
|
37
|
* The search criteria.
|
38
|
38
|
*/
|
39
|
|
- _criteria: string,
|
|
39
|
+ _criteria: string | null,
|
40
|
40
|
|
41
|
41
|
/**
|
42
|
42
|
* The JitsiConference from which stats will be pulled.
|
|
@@ -140,24 +140,9 @@ class SpeakerStats extends Component<Props> {
|
140
|
140
|
const dominantSpeakerTime = statsModel.getTotalDominantSpeakerTime();
|
141
|
141
|
const hasLeft = statsModel.hasLeft();
|
142
|
142
|
|
143
|
|
- let displayName;
|
144
|
|
-
|
145
|
|
- if (statsModel.isLocalStats()) {
|
146
|
|
- const { t } = this.props;
|
147
|
|
- const meString = t('me');
|
148
|
|
-
|
149
|
|
- displayName = this.props._localDisplayName;
|
150
|
|
- displayName
|
151
|
|
- = displayName ? `${displayName} (${meString})` : meString;
|
152
|
|
- } else {
|
153
|
|
- displayName
|
154
|
|
- = this.props._stats[userId].getDisplayName()
|
155
|
|
- || interfaceConfig.DEFAULT_REMOTE_DISPLAY_NAME;
|
156
|
|
- }
|
157
|
|
-
|
158
|
143
|
return (
|
159
|
144
|
<SpeakerStatsItem
|
160
|
|
- displayName = { displayName }
|
|
145
|
+ displayName = { statsModel.getDisplayName() }
|
161
|
146
|
dominantSpeakerTime = { dominantSpeakerTime }
|
162
|
147
|
hasLeft = { hasLeft }
|
163
|
148
|
isDominantSpeaker = { isDominantSpeaker }
|
|
@@ -187,7 +172,40 @@ class SpeakerStats extends Component<Props> {
|
187
|
172
|
* @private
|
188
|
173
|
*/
|
189
|
174
|
_updateStats() {
|
190
|
|
- this.props.dispatch(initUpdateStats(() => this.props.conference.getSpeakerStats()));
|
|
175
|
+ this.props.dispatch(initUpdateStats(() => this._getSpeakerStats()));
|
|
176
|
+ }
|
|
177
|
+
|
|
178
|
+ /**
|
|
179
|
+ * Update the internal state with the latest speaker stats.
|
|
180
|
+ *
|
|
181
|
+ * @returns {Object}
|
|
182
|
+ * @private
|
|
183
|
+ */
|
|
184
|
+ _getSpeakerStats() {
|
|
185
|
+ const stats = { ...this.props.conference.getSpeakerStats() };
|
|
186
|
+
|
|
187
|
+ for (const userId in stats) {
|
|
188
|
+ if (stats[userId]) {
|
|
189
|
+ if (stats[userId].isLocalStats()) {
|
|
190
|
+ const { t } = this.props;
|
|
191
|
+ const meString = t('me');
|
|
192
|
+
|
|
193
|
+ stats[userId].setDisplayName(
|
|
194
|
+ this.props._localDisplayName
|
|
195
|
+ ? `${this.props._localDisplayName} (${meString})`
|
|
196
|
+ : meString
|
|
197
|
+ );
|
|
198
|
+ }
|
|
199
|
+
|
|
200
|
+ if (!stats[userId].getDisplayName()) {
|
|
201
|
+ stats[userId].setDisplayName(
|
|
202
|
+ interfaceConfig.DEFAULT_REMOTE_DISPLAY_NAME
|
|
203
|
+ );
|
|
204
|
+ }
|
|
205
|
+ }
|
|
206
|
+ }
|
|
207
|
+
|
|
208
|
+ return stats;
|
191
|
209
|
}
|
192
|
210
|
}
|
193
|
211
|
|
|
@@ -198,8 +216,7 @@ class SpeakerStats extends Component<Props> {
|
198
|
216
|
* @private
|
199
|
217
|
* @returns {{
|
200
|
218
|
* _localDisplayName: ?string,
|
201
|
|
- * _stats: Object,
|
202
|
|
- * _criteria: string,
|
|
219
|
+ * _stats: Object
|
203
|
220
|
* }}
|
204
|
221
|
*/
|
205
|
222
|
function _mapStateToProps(state) {
|
|
@@ -213,8 +230,7 @@ function _mapStateToProps(state) {
|
213
|
230
|
* @type {string|undefined}
|
214
|
231
|
*/
|
215
|
232
|
_localDisplayName: localParticipant && localParticipant.name,
|
216
|
|
- _stats: getSpeakerStats(state),
|
217
|
|
- _criteria: getSearchCriteria(state)
|
|
233
|
+ _stats: getSpeakerStats(state)
|
218
|
234
|
};
|
219
|
235
|
}
|
220
|
236
|
|