Browse Source

hide chat if local display name is empty

master
isymchych 9 years ago
parent
commit
ebf57923ae

+ 7
- 1
conference.js View File

860
             APP.UI.setUserAvatar(data.attributes.id, data.value);
860
             APP.UI.setUserAvatar(data.attributes.id, data.value);
861
         });
861
         });
862
 
862
 
863
-        APP.UI.addListener(UIEvents.NICKNAME_CHANGED, (nickname) => {
863
+        APP.UI.addListener(UIEvents.NICKNAME_CHANGED, (nickname = '') => {
864
+            nickname = nickname.trim();
865
+
866
+            if (nickname === APP.settings.getDisplayName()) {
867
+                return;
868
+            }
869
+
864
             APP.settings.setDisplayName(nickname);
870
             APP.settings.setDisplayName(nickname);
865
             room.setDisplayName(nickname);
871
             room.setDisplayName(nickname);
866
             APP.UI.changeDisplayName(APP.conference.localId, nickname);
872
             APP.UI.changeDisplayName(APP.conference.localId, nickname);

+ 15
- 0
css/chat.css View File

22
     overflow-x: hidden;
22
     overflow-x: hidden;
23
     word-wrap: break-word;
23
     word-wrap: break-word;
24
 }
24
 }
25
+#chatspace.is-conversation-mode #chatconversation {
26
+    visibility: visible;
27
+}
25
 
28
 
26
 .localuser {
29
 .localuser {
27
     color: #087dba;
30
     color: #087dba;
61
     box-shadow: none;
64
     box-shadow: none;
62
 }
65
 }
63
 
66
 
67
+#chatspace.is-conversation-mode #usermsg {
68
+    visibility: visible;
69
+}
70
+
64
 #nickname {
71
 #nickname {
65
     position: absolute;
72
     position: absolute;
66
     text-align: center;
73
     text-align: center;
72
     width: 95%;
79
     width: 95%;
73
 }
80
 }
74
 
81
 
82
+#chatspace.is-conversation-mode #nickname {
83
+    visibility: hidden;
84
+}
85
+
75
 #nickinput {
86
 #nickinput {
76
     margin-top: 20px;
87
     margin-top: 20px;
77
     font-size: 14px;
88
     font-size: 14px;
168
     visibility: hidden;
179
     visibility: hidden;
169
 }
180
 }
170
 
181
 
182
+#chatspace.is-conversation-mode #smileysarea {
183
+    visibility: visible;
184
+}
185
+
171
 #smileysContainer {
186
 #smileysContainer {
172
     display: none;
187
     display: none;
173
     position: absolute;
188
     position: absolute;

+ 1
- 1
modules/UI/UI.js View File

560
         messageHandler.notify(
560
         messageHandler.notify(
561
             displayName, 'notify.somebody',
561
             displayName, 'notify.somebody',
562
             'connected', 'notify.grantedTo', {
562
             'connected', 'notify.grantedTo', {
563
-                to: displayName
563
+                to: UIUtil.escapeHtml(displayName)
564
             }
564
             }
565
         );
565
         );
566
     } else {
566
     } else {

+ 3
- 4
modules/UI/side_pannels/chat/Chat.js View File

292
 
292
 
293
     /**
293
     /**
294
      * Sets the chat conversation mode.
294
      * Sets the chat conversation mode.
295
+     * @param {boolean} isConversationMode if chat should be in
296
+     * conversation mode or not.
295
      */
297
      */
296
     setChatConversationMode (isConversationMode) {
298
     setChatConversationMode (isConversationMode) {
299
+        $('#chatspace').toggleClass('is-conversation-mode', isConversationMode);
297
         if (isConversationMode) {
300
         if (isConversationMode) {
298
-            $('#nickname').css({visibility: 'hidden'});
299
-            $('#chatconversation').css({visibility: 'visible'});
300
-            $('#usermsg').css({visibility: 'visible'});
301
-            $('#smileysarea').css({visibility: 'visible'});
302
             $('#usermsg').focus();
301
             $('#usermsg').focus();
303
         }
302
         }
304
     },
303
     },

+ 1
- 3
modules/UI/side_pannels/settings/SettingsMenu.js View File

42
         function update() {
42
         function update() {
43
             let displayName = $('#setDisplayName').val();
43
             let displayName = $('#setDisplayName').val();
44
 
44
 
45
-            if (displayName && Settings.getDisplayName() !== displayName) {
46
-                emitter.emit(UIEvents.NICKNAME_CHANGED, displayName);
47
-            }
45
+            emitter.emit(UIEvents.NICKNAME_CHANGED, displayName);
48
 
46
 
49
             let language = $("#languages_selectbox").val();
47
             let language = $("#languages_selectbox").val();
50
             if (language !== Settings.getLanguage()) {
48
             if (language !== Settings.getLanguage()) {

Loading…
Cancel
Save