From 62d2e3e2a4fb12d278a48c22171299f58e69134b Mon Sep 17 00:00:00 2001 From: paweldomas Date: Sat, 24 Sep 2016 11:46:19 -0500 Subject: [PATCH] feat(conference.js): add 'getParticipantDisplayName' --- conference.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/conference.js b/conference.js index d12ff9c8d..c06c19181 100644 --- a/conference.js +++ b/conference.js @@ -714,6 +714,28 @@ export default { let participant = this.getParticipantById(id); return participant ? participant.isConnectionActive() : null; }, + /** + * Gets the display name foe the JitsiParticipant identified by + * the given id. + * + * @param id {string} the participant's id(MUC nickname/JVB endpoint id) + * + * @return {string} the participant's display name or the default string if + * absent. + */ + getParticipantDisplayName (id) { + let displayName = getDisplayName(id); + if (displayName) { + return displayName; + } else { + if (APP.conference.isLocalId(id)) { + return APP.translation.generateTranslationHTML( + interfaceConfig.DEFAULT_LOCAL_DISPLAY_NAME); + } else { + return interfaceConfig.DEFAULT_REMOTE_DISPLAY_NAME; + } + } + }, getMyUserId () { return this._room && this._room.myUserId();