diff --git a/app/assets/javascripts/discourse/lib/sharing.js.es6 b/app/assets/javascripts/discourse/lib/sharing.js.es6 index 6aa23a442f8..f8d2e4fe406 100644 --- a/app/assets/javascripts/discourse/lib/sharing.js.es6 +++ b/app/assets/javascripts/discourse/lib/sharing.js.es6 @@ -24,17 +24,15 @@ ``` **/ -var _sources = []; +var _sources = {}; export default { - addSource: function (source) { - _sources.push(source); + addSource(source) { + _sources[source.id] = source; }, - activeSources: function() { - var enabled = Discourse.SiteSettings.share_links.split('|'); - return _sources.filter(function(s) { - return enabled.indexOf(s.id) !== -1; - }); + activeSources() { + const enabled = Discourse.SiteSettings.share_links.split('|'); + return enabled.map(s => _sources[s]).compact(); } };