瀏覽代碼

feat(conference.js): add 'getParticipantDisplayName'

master
paweldomas 8 年之前
父節點
當前提交
62d2e3e2a4
共有 1 個文件被更改,包括 22 次插入0 次删除
  1. 22
    0
      conference.js

+ 22
- 0
conference.js 查看文件

@@ -714,6 +714,28 @@ export default {
714 714
         let participant = this.getParticipantById(id);
715 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 739
     getMyUserId () {
718 740
         return this._room
719 741
             && this._room.myUserId();

Loading…
取消
儲存