From 7d634ab54b90a0e1efe28edb48dd13d17ee6038b Mon Sep 17 00:00:00 2001 From: ansuz Date: Thu, 1 Jul 2021 13:58:17 +0530 Subject: [PATCH] suppress 'convert' from new pad modal and make it easy to configure what's displayed via a list in appconfig --- www/common/application_config_internal.js | 6 ++++++ www/common/common-ui-elements.js | 10 ++-------- www/common/drive-ui.js | 1 + 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/www/common/application_config_internal.js b/www/common/application_config_internal.js index 68ba4ed06..971da32ee 100644 --- a/www/common/application_config_internal.js +++ b/www/common/application_config_internal.js @@ -22,6 +22,12 @@ define(function() { */ AppConfig.registeredOnlyTypes = ['file', 'contacts', 'notifications', 'support']; + // XXX to prevent apps that aren't officially supported from showing up + // in the document creation modal + AppConfig.hiddenTypes = ['drive', 'teams', 'contacts', 'todo', 'file', 'accounts', 'calendar', 'poll', 'convert', + //'doc', 'presentation' + ]; + /* CryptPad is available is multiple languages, but only English and French are maintained * by the developers. The other languages may be outdated, and any missing string for a langauge * will use the english version instead. You can customize the langauges you want to be available diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 3e27b4ee7..a7ef39de6 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -2075,15 +2075,9 @@ define([ var $container = $('
'); var i = 0; + var types = AppConfig.availablePadTypes.filter(function (p) { - if (p === 'drive') { return; } - if (p === 'teams') { return; } - if (p === 'contacts') { return; } - if (p === 'todo') { return; } - if (p === 'file') { return; } - if (p === 'accounts') { return; } - if (p === 'calendar') { return; } - if (p === 'poll') { return; } // Replaced by forms + if (AppConfig.hiddenTypes.indexOf(p) !== -1) { return; } if (!common.isLoggedIn() && AppConfig.registeredOnlyTypes && AppConfig.registeredOnlyTypes.indexOf(p) !== -1) { return; } return true; diff --git a/www/common/drive-ui.js b/www/common/drive-ui.js index 4a75459a5..0db7018eb 100644 --- a/www/common/drive-ui.js +++ b/www/common/drive-ui.js @@ -3082,6 +3082,7 @@ define([ } // Pads getNewPadTypes().forEach(function (type) { + if (AppConfig.hiddenTypes.indexOf(type) !== -1) { return; } var $element = $('
  • ', { 'class': 'cp-app-drive-new-doc cp-app-drive-element-row ' + 'cp-app-drive-element-grid'