Browse Source

feat(conference.js): add 'getParticipantDisplayName'

master
paweldomas 8 years ago
parent
commit
62d2e3e2a4
1 changed files with 22 additions and 0 deletions
  1. 22
    0
      conference.js

+ 22
- 0
conference.js View File

714
         let participant = this.getParticipantById(id);
714
         let participant = this.getParticipantById(id);
715
         return participant ? participant.isConnectionActive() : null;
715
         return participant ? participant.isConnectionActive() : null;
716
     },
716
     },
717
+    /**
718
+     * Gets the display name foe the <tt>JitsiParticipant</tt> identified by
719
+     * the given <tt>id</tt>.
720
+     *
721
+     * @param id {string} the participant's id(MUC nickname/JVB endpoint id)
722
+     *
723
+     * @return {string} the participant's display name or the default string if
724
+     * absent.
725
+     */
726
+    getParticipantDisplayName (id) {
727
+        let displayName = getDisplayName(id);
728
+        if (displayName) {
729
+            return displayName;
730
+        } else {
731
+            if (APP.conference.isLocalId(id)) {
732
+                return APP.translation.generateTranslationHTML(
733
+                    interfaceConfig.DEFAULT_LOCAL_DISPLAY_NAME);
734
+            } else {
735
+                return interfaceConfig.DEFAULT_REMOTE_DISPLAY_NAME;
736
+            }
737
+        }
738
+    },
717
     getMyUserId () {
739
     getMyUserId () {
718
         return this._room
740
         return this._room
719
             && this._room.myUserId();
741
             && this._room.myUserId();

Loading…
Cancel
Save