avatar: make code a bit clearer
Uses nullish coalescing and optional chaining.
This commit is contained in:
parent
abefc56750
commit
69c21cbb11
|
@ -176,11 +176,11 @@ class Avatar<P: Props> extends PureComponent<P, State> {
|
|||
*/
|
||||
export function _mapStateToProps(state: Object, ownProps: Props) {
|
||||
const { colorBase, displayName, participantId } = ownProps;
|
||||
const _participant = participantId && getParticipantById(state, participantId);
|
||||
const _initialsBase = (_participant && _participant.name) || displayName;
|
||||
const _participant: ?Object = participantId && getParticipantById(state, participantId);
|
||||
const _initialsBase = _participant?.name ?? displayName;
|
||||
const screenShares = state['features/video-layout'].screenShares || [];
|
||||
|
||||
let _loadableAvatarUrl = _participant && _participant.loadableAvatarUrl;
|
||||
let _loadableAvatarUrl = _participant?.loadableAvatarUrl;
|
||||
|
||||
if (participantId && screenShares.includes(participantId)) {
|
||||
_loadableAvatarUrl = 'icon://share-desktop';
|
||||
|
|
Loading…
Reference in New Issue