Only show the user colors in the userlist if the app supports it
This commit is contained in:
@@ -647,7 +647,10 @@ define([
|
|||||||
setContentGetter: function (cg) { contentGetter = cg; },
|
setContentGetter: function (cg) { contentGetter = cg; },
|
||||||
|
|
||||||
// Set the function providing the cursor position when request by the framework.
|
// Set the function providing the cursor position when request by the framework.
|
||||||
setCursorGetter: function (cg) { cursorGetter = cg; },
|
setCursorGetter: function (cg) {
|
||||||
|
toolbar.showColors();
|
||||||
|
cursorGetter = cg;
|
||||||
|
},
|
||||||
onCursorUpdate: evCursorUpdate.reg,
|
onCursorUpdate: evCursorUpdate.reg,
|
||||||
updateCursor: function () {
|
updateCursor: function () {
|
||||||
if (cursor && cursorGetter) {
|
if (cursor && cursorGetter) {
|
||||||
|
|||||||
@@ -5,10 +5,11 @@ define([
|
|||||||
'/common/common-ui-elements.js',
|
'/common/common-ui-elements.js',
|
||||||
'/common/common-interface.js',
|
'/common/common-interface.js',
|
||||||
'/common/common-hash.js',
|
'/common/common-hash.js',
|
||||||
|
'/common/common-util.js',
|
||||||
'/common/common-feedback.js',
|
'/common/common-feedback.js',
|
||||||
'/contacts/messenger-ui.js',
|
'/contacts/messenger-ui.js',
|
||||||
'/customize/messages.js',
|
'/customize/messages.js',
|
||||||
], function ($, Config, ApiConfig, UIElements, UI, Hash, Feedback,
|
], function ($, Config, ApiConfig, UIElements, UI, Hash, Util, Feedback,
|
||||||
MessengerUI, Messages) {
|
MessengerUI, Messages) {
|
||||||
var Common;
|
var Common;
|
||||||
|
|
||||||
@@ -161,6 +162,7 @@ MessengerUI, Messages) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
var showColors = false;
|
||||||
var updateUserList = function (toolbar, config) {
|
var updateUserList = function (toolbar, config) {
|
||||||
// Make sure the elements are displayed
|
// Make sure the elements are displayed
|
||||||
var $userButtons = toolbar.userlist;
|
var $userButtons = toolbar.userlist;
|
||||||
@@ -231,7 +233,7 @@ MessengerUI, Messages) {
|
|||||||
editUsersNames.forEach(function (data) {
|
editUsersNames.forEach(function (data) {
|
||||||
var name = data.name || Messages.anonymous;
|
var name = data.name || Messages.anonymous;
|
||||||
var $span = $('<span>', {'class': 'cp-avatar'});
|
var $span = $('<span>', {'class': 'cp-avatar'});
|
||||||
if (data.color) {
|
if (data.color && showColors) {
|
||||||
$span.css('border-color', data.color);
|
$span.css('border-color', data.color);
|
||||||
}
|
}
|
||||||
var $rightCol = $('<span>', {'class': 'cp-toolbar-userlist-rightcol'});
|
var $rightCol = $('<span>', {'class': 'cp-toolbar-userlist-rightcol'});
|
||||||
@@ -1169,6 +1171,16 @@ MessengerUI, Messages) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Show user colors in the userlist only if the app is compatible and if the user
|
||||||
|
// wants to see the cursors
|
||||||
|
toolbar.showColors = function () {
|
||||||
|
if (!config.metadataMgr) { return; }
|
||||||
|
var privateData = config.metadataMgr.getPrivateData();
|
||||||
|
var show = Util.find(privateData, ['settings', 'general', 'cursor', 'show']);
|
||||||
|
if (show === false) { return; }
|
||||||
|
showColors = true;
|
||||||
|
};
|
||||||
|
|
||||||
// On log out, remove permanently the realtime elements of the toolbar
|
// On log out, remove permanently the realtime elements of the toolbar
|
||||||
Common.onLogout(function () {
|
Common.onLogout(function () {
|
||||||
failed();
|
failed();
|
||||||
|
|||||||
Reference in New Issue
Block a user