From 69c21cbb11e9f00d38dc966df19e7509077d391e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Wed, 14 Aug 2019 14:26:46 +0200 Subject: [PATCH] avatar: make code a bit clearer Uses nullish coalescing and optional chaining. --- react/features/base/avatar/components/Avatar.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/react/features/base/avatar/components/Avatar.js b/react/features/base/avatar/components/Avatar.js index d87e2d772..ef80d0105 100644 --- a/react/features/base/avatar/components/Avatar.js +++ b/react/features/base/avatar/components/Avatar.js @@ -176,11 +176,11 @@ class Avatar extends PureComponent { */ 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';