Fix double separator in user menu

pull/1/head
yflory 4 years ago
parent 406d3cdd0e
commit d7cce80bca

@ -1738,7 +1738,14 @@ define([
}); });
}*/ }*/
options.push({ tag: 'hr' }); 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) { if (Config.allowSubscriptions) {
surveyAlone = false;
options.push({ options.push({
tag: 'a', tag: 'a',
attributes: { attributes: {
@ -1751,6 +1758,7 @@ define([
}); });
} }
if (!priv.plan && !Config.removeDonateButton) { if (!priv.plan && !Config.removeDonateButton) {
surveyAlone = false;
options.push({ options.push({
tag: 'a', tag: 'a',
attributes: { attributes: {
@ -1844,7 +1852,10 @@ define([
var $userAdmin = UIElements.createDropdown(dropdownConfigUser); var $userAdmin = UIElements.createDropdown(dropdownConfigUser);
var $survey = $userAdmin.find('.cp-toolbar-survey'); var $survey = $userAdmin.find('.cp-toolbar-survey');
if (!surveyURL) { $survey.hide(); } if (!surveyURL) {
$survey.hide();
if (surveyAlone) { $survey.next('hr').hide(); }
}
Common.makeUniversal('broadcast', { Common.makeUniversal('broadcast', {
onEvent: function (obj) { onEvent: function (obj) {
var cmd = obj.ev; var cmd = obj.ev;
@ -1855,9 +1866,11 @@ define([
surveyURL = url; surveyURL = url;
if (!url) { if (!url) {
$survey.hide(); $survey.hide();
if (surveyAlone) { $survey.next('hr').hide(); }
return; return;
} }
$survey.show(); $survey.show();
if (surveyAlone) { $survey.next('hr').show(); }
} }
}); });

Loading…
Cancel
Save