diff --git a/CHANGELOG.md b/CHANGELOG.md index 74609656b0..919750aed2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ HumHub Changelog - Fix #6377: Forgot Password - Display email input error after successful captcha verification. - Fix #6378: Fix visibility of the link "Uninstall" on Windows server - Fix #6404: Fix visibility of global content on dashboard for registered users +- Fix #6441: Display topics and content types in filters header on load page with selected filters 1.14.2 (May 22, 2023) ---------------------- diff --git a/protected/humhub/modules/stream/resources/js/humhub.stream.wall.js b/protected/humhub/modules/stream/resources/js/humhub.stream.wall.js index 5e6fab2107..3679db0c68 100644 --- a/protected/humhub/modules/stream/resources/js/humhub.stream.wall.js +++ b/protected/humhub/modules/stream/resources/js/humhub.stream.wall.js @@ -299,32 +299,34 @@ humhub.module('stream.wall', function (module, require, $) { }; WallStreamFilter.prototype.initTopicPicker = function() { - var that = this; - var topicPicker = this.getTopicPicker(); - if(topicPicker) { - topicPicker.$.on('change', function() { - var topics = []; - $.each(that.getTopicPicker().map(), function(key, value) { + const topicPicker = this.getTopicPicker(); + if (topicPicker) { + const updateFilterBar = function () { + const topics = []; + $.each(topicPicker.map(), function(key, value) { topics.push({id:key, name: value}) }); - // Note the stream init is triggered by the humhub:topic:updated event topic.setTopics(topics); - }); + } + topicPicker.on('afterInitSelect2', updateFilterBar) + .$.on('change', updateFilterBar); } }; WallStreamFilter.prototype.initContentTypePicker = function() { - var that = this; - var contentTypePicker = this.getContentTypePicker(); - if(contentTypePicker) { - contentTypePicker.$.on('change', function() { - var $filterBar = that.getFilterBar(); + const that = this; + const contentTypePicker = this.getContentTypePicker(); + if (contentTypePicker) { + const updateFilterBar = function () { + const $filterBar = that.getFilterBar(); $filterBar.find('.content-type-remove-label').remove(); - Widget.instance($(this)).data().forEach(function(contentType) { + contentTypePicker.data().forEach(function(contentType) { $(string.template(WallStreamFilter.template.removeContentTypeLabel, contentType)).appendTo($filterBar); }); - }); + } + contentTypePicker.on('afterInitSelect2', updateFilterBar) + .$.on('change', updateFilterBar); } }; diff --git a/static/js/humhub/humhub.ui.picker.js b/static/js/humhub/humhub.ui.picker.js index 322dd30426..5e7502ed57 100644 --- a/static/js/humhub/humhub.ui.picker.js +++ b/static/js/humhub/humhub.ui.picker.js @@ -170,6 +170,8 @@ humhub.module('ui.picker', function (module, require, $) { if ($node.data('picker-focus')) { Widget.instance($node).focus(); } + + Widget.instance($node).fire('afterInitSelect2'); }); };