From d7cce80bca830d545354ce75a6ae5fcf7ac338bb Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 8 Apr 2021 17:54:29 +0200 Subject: [PATCH] Fix double separator in user menu --- www/common/common-ui-elements.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 92ecb4b4e..c495364a4 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1738,7 +1738,14 @@ define([ }); }*/ options.push({ tag: 'hr' }); + + // We have code to hide 2 separators in a row, but in the case of survey, they may be + // in the DOM but hidden. We need to know if there are other elements in this + // section to determine if we have to manually hide a separator. + var surveyAlone = true; + if (Config.allowSubscriptions) { + surveyAlone = false; options.push({ tag: 'a', attributes: { @@ -1751,6 +1758,7 @@ define([ }); } if (!priv.plan && !Config.removeDonateButton) { + surveyAlone = false; options.push({ tag: 'a', attributes: { @@ -1844,7 +1852,10 @@ define([ var $userAdmin = UIElements.createDropdown(dropdownConfigUser); var $survey = $userAdmin.find('.cp-toolbar-survey'); - if (!surveyURL) { $survey.hide(); } + if (!surveyURL) { + $survey.hide(); + if (surveyAlone) { $survey.next('hr').hide(); } + } Common.makeUniversal('broadcast', { onEvent: function (obj) { var cmd = obj.ev; @@ -1855,9 +1866,11 @@ define([ surveyURL = url; if (!url) { $survey.hide(); + if (surveyAlone) { $survey.next('hr').hide(); } return; } $survey.show(); + if (surveyAlone) { $survey.next('hr').show(); } } });