From 9e17fd890759684bf2509cf1f29bf3d759b2f13d Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Tue, 26 Sep 2017 09:50:43 -0400 Subject: [PATCH] FIX: Support for menu glyphs that are optional --- .../javascripts/discourse/widgets/user-menu.js.es6 | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/discourse/widgets/user-menu.js.es6 b/app/assets/javascripts/discourse/widgets/user-menu.js.es6 index bdb1c4ed9bd..db8207c688b 100644 --- a/app/assets/javascripts/discourse/widgets/user-menu.js.es6 +++ b/app/assets/javascripts/discourse/widgets/user-menu.js.es6 @@ -23,9 +23,14 @@ createWidget('user-menu-links', { const glyphs = []; if (extraGlyphs) { - // yes glyphs.push(...extraGlyphs) is nicer, but pulling in - // _toConsumableArray seems totally uneeded here - glyphs.push.apply(glyphs, extraGlyphs); + extraGlyphs.forEach(g => { + if (typeof g === "function") { + g = g(this); + } + if (g) { + glyphs.push(g); + } + }); } glyphs.push({ label: 'user.bookmarks',