Merge pull request #1102 from jitsi/limit_display_name
Limit long display names
This commit is contained in:
commit
70c3c1a21c
|
@ -45,6 +45,12 @@ const commands = {
|
||||||
CUSTOM_ROLE: "custom-role"
|
CUSTOM_ROLE: "custom-role"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Max length of the display names. If we receive longer display name the
|
||||||
|
* additional chars are going to be cut.
|
||||||
|
*/
|
||||||
|
const MAX_DISPLAY_NAME_LENGTH = 50;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open Connection. When authentication failed it shows auth dialog.
|
* Open Connection. When authentication failed it shows auth dialog.
|
||||||
* @param roomName the room name to use
|
* @param roomName the room name to use
|
||||||
|
@ -273,15 +279,16 @@ function changeLocalEmail(email = '') {
|
||||||
* @param nickname {string} the new display name
|
* @param nickname {string} the new display name
|
||||||
*/
|
*/
|
||||||
function changeLocalDisplayName(nickname = '') {
|
function changeLocalDisplayName(nickname = '') {
|
||||||
nickname = nickname.trim();
|
const formattedNickname
|
||||||
|
= nickname.trim().substr(0, MAX_DISPLAY_NAME_LENGTH);
|
||||||
|
|
||||||
if (nickname === APP.settings.getDisplayName()) {
|
if (formattedNickname === APP.settings.getDisplayName()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
APP.settings.setDisplayName(nickname);
|
APP.settings.setDisplayName(formattedNickname);
|
||||||
room.setDisplayName(nickname);
|
room.setDisplayName(formattedNickname);
|
||||||
APP.UI.changeDisplayName(APP.conference.getMyUserId(), nickname);
|
APP.UI.changeDisplayName(APP.conference.getMyUserId(), formattedNickname);
|
||||||
}
|
}
|
||||||
|
|
||||||
class ConferenceConnector {
|
class ConferenceConnector {
|
||||||
|
@ -1252,8 +1259,10 @@ export default {
|
||||||
});
|
});
|
||||||
|
|
||||||
room.on(ConferenceEvents.DISPLAY_NAME_CHANGED, (id, displayName) => {
|
room.on(ConferenceEvents.DISPLAY_NAME_CHANGED, (id, displayName) => {
|
||||||
APP.API.notifyDisplayNameChanged(id, displayName);
|
const formattedDisplayName
|
||||||
APP.UI.changeDisplayName(id, displayName);
|
= displayName.substr(0, MAX_DISPLAY_NAME_LENGTH);
|
||||||
|
APP.API.notifyDisplayNameChanged(id, formattedDisplayName);
|
||||||
|
APP.UI.changeDisplayName(id, formattedDisplayName);
|
||||||
});
|
});
|
||||||
|
|
||||||
room.on(ConferenceEvents.PARTICIPANT_PROPERTY_CHANGED,
|
room.on(ConferenceEvents.PARTICIPANT_PROPERTY_CHANGED,
|
||||||
|
|
|
@ -107,6 +107,10 @@
|
||||||
float: left;
|
float: left;
|
||||||
padding-left: 5px;
|
padding-left: 5px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
width: 95%;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
#chat_container .timestamp {
|
#chat_container .timestamp {
|
||||||
|
|
Loading…
Reference in New Issue