From 52529f1a652bb955b4728993097f2a3aee4c5740 Mon Sep 17 00:00:00 2001 From: ansuz Date: Fri, 18 Feb 2022 13:41:08 +0530 Subject: [PATCH] hide the 'embed' tab of the share menu if 'disableEmbedding' is true --- www/common/inner/share.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/www/common/inner/share.js b/www/common/inner/share.js index 73d736346..aaf4583db 100644 --- a/www/common/inner/share.js +++ b/www/common/inner/share.js @@ -1,5 +1,6 @@ define([ 'jquery', + '/api/config', '/common/common-util.js', '/common/common-hash.js', '/common/common-interface.js', @@ -11,7 +12,7 @@ define([ '/customize/messages.js', '/bower_components/nthen/index.js', '/customize/pages.js', -], function ($, Util, Hash, UI, UIElements, Feedback, Modal, h, Clipboard, +], function ($, ApiConfig, Util, Hash, UI, UIElements, Feedback, Modal, h, Clipboard, Messages, nThen, Pages) { var Share = {}; @@ -771,9 +772,9 @@ define([ icon: "fa fa-link", active: !contactsActive, }]; - if (!opts.static) { + if (!opts.static && !ApiConfig.disableEmbedding) { tabs.push({ - getTab: getEmbedTab, + getTab: getEmbedTab, // XXX title: Messages.share_embedCategory, icon: "fa fa-code", onShow: onShowEmbed, @@ -965,11 +966,16 @@ define([ title: Messages.share_linkCategory, icon: "fa fa-link", active: !hasFriends, - }, { - getTab: getFileEmbedTab, - title: Messages.share_embedCategory, - icon: "fa fa-code", }]; + + if (!ApiConfig.disableEmbedding) { + tabs.push({ + getTab: getFileEmbedTab, + title: Messages.share_embedCategory, + icon: "fa fa-code", + }); + } + Modal.getModal(common, opts, tabs, cb); };