From 69c33e2f8380fad794be389820d381c5eb02d026 Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 23 Jan 2018 14:24:40 +0100 Subject: [PATCH] Ability to disable profile --- www/common/application_config_internal.js | 9 ++- www/common/common-ui-elements.js | 6 +- www/common/toolbar3.js | 96 ++++++++++++----------- www/profile/inner.js | 6 ++ www/settings/inner.js | 7 +- 5 files changed, 70 insertions(+), 54 deletions(-) diff --git a/www/common/application_config_internal.js b/www/common/application_config_internal.js index bea0bc343..24c46b790 100644 --- a/www/common/application_config_internal.js +++ b/www/common/application_config_internal.js @@ -88,14 +88,14 @@ define(function() { //config.hideUsageBar = true; // Disable feedback for all the users and hide the settings part about feedback - config.disableFeedback = true; + //config.disableFeedback = true; // Add new options in the share modal (extend an existing tab or add a new tab). // More info about how to use it on the wiki: // https://github.com/xwiki-labs/cryptpad/wiki/Application-config#configcustomizeshareoptions //config.customizeShareOptions = function (hashes, tabs, config) {}; - // Add code to be executed on every page before loading the user object. `isLoggedIn` is a boolean + // Add code to be executed on every page before loading the user object. `isLoggedIn` (bool) is // indicating if the user is registered or anonymous. Here you can change the way anonymous users // work in CryptPad, use an external SSO or even force registration // *NOTE*: You have to call the `callback` function to continue the loading process @@ -106,5 +106,10 @@ define(function() { // *NOTE*: You have to call the `callback` function to continue the loading process //config.afterLogin = function(api, callback) {}; + // Disabling the profile app allows you to import the profile informations (display name, avatar) + // from an external source and make sure the users can't change them from CryptPad. + // You can use config.afterLogin to import these values in the users' drive. + //config.disableProfile = true; + return config; }); diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index dbbf86b71..0100be3f8 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1274,7 +1274,7 @@ define([ $userAdminContent.append($userAccount).append(Util.fixHTML(accountName)); $userAdminContent.append($('
')); } - if (config.displayName) { + if (config.displayName && !AppConfig.disableProfile) { // Hide "Display name:" in read only mode $userName.append(Messages.user_displayName + ': '); $userName.append($displayedName); @@ -1297,14 +1297,14 @@ define([ }); } // Add the change display name button if not in read only mode - if (config.changeNameButtonCls && config.displayChangeName) { + if (config.changeNameButtonCls && config.displayChangeName && !AppConfig.disableProfile) { options.push({ tag: 'a', attributes: {'class': config.changeNameButtonCls}, content: Messages.user_rename }); } - if (accountName) { + if (accountName && !AppConfig.disableProfile) { options.push({ tag: 'a', attributes: {'class': 'cp-toolbar-menu-profile'}, diff --git a/www/common/toolbar3.js b/www/common/toolbar3.js index 03cb9d7c1..c7afbaca8 100644 --- a/www/common/toolbar3.js +++ b/www/common/toolbar3.js @@ -238,55 +238,57 @@ define([ var $nameValue = $('', { 'class': 'cp-toolbar-userlist-name-value' }).text(name).appendTo($nameSpan); - var $button = $('