mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
FIX: 🐛 supress the category badge even when refreshing
This commit is contained in:
parent
20d2908c50
commit
9c977a08cd
3 changed files with 9 additions and 12 deletions
|
@ -50,6 +50,8 @@ var controllerOpts = {
|
|||
// Lesson learned: Don't call `loading` yourself.
|
||||
this.set('controllers.discovery.loading', true);
|
||||
Discourse.TopicList.find(filter).then(function(list) {
|
||||
Discourse.TopicList.hideUniformCategory(list, self.get('category'));
|
||||
|
||||
self.setProperties({ model: list, selected: [] });
|
||||
|
||||
var tracking = Discourse.TopicTrackingState.current();
|
||||
|
|
|
@ -1,12 +1,3 @@
|
|||
/**
|
||||
A data model representing a list of topics
|
||||
|
||||
@class TopicList
|
||||
@extends Discourse.Model
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
|
||||
function finderFor(filter, params) {
|
||||
return function() {
|
||||
var url = Discourse.getURL("/") + filter + ".json";
|
||||
|
@ -264,6 +255,12 @@ Discourse.TopicList.reopenClass({
|
|||
return PreloadStore.getAndRemove("topic_list_" + filter, finderFor(filter, params)).then(function(result) {
|
||||
return Discourse.TopicList.from(result, filter, params);
|
||||
});
|
||||
},
|
||||
|
||||
// Sets `hideCategory` if all topics in the last have a particular category
|
||||
hideUniformCategory: function(list, category) {
|
||||
var hideCategory = !list.get('topics').any(function (t) { return t.get('category') !== category; });
|
||||
list.set('hideCategory', hideCategory);
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -54,9 +54,7 @@ export default function(filter, params) {
|
|||
extras = { cached: this.isPoppedState(transition) };
|
||||
|
||||
return Discourse.TopicList.list(listFilter, findOpts, extras).then(function(list) {
|
||||
// If all the categories are the same, we can hide them
|
||||
var hideCategory = !list.get('topics').find(function (t) { return t.get('category') !== model; });
|
||||
list.set('hideCategory', hideCategory);
|
||||
Discourse.TopicList.hideUniformCategory(list, model);
|
||||
self.set('topics', list);
|
||||
});
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue