mirror of
https://github.com/discourse/discourse.git
synced 2025-03-04 02:31:55 +08:00
FIX: refresh "/categories" on logo click (#6891)
* FIX: refresh discovery categories on logo click * Fix prettier offence
This commit is contained in:
parent
9f52306861
commit
2274d6d7ac
@ -46,5 +46,10 @@ export default DiscoveryController.extend({
|
||||
? "categories_only"
|
||||
: style;
|
||||
return Ember.String.dasherize(componentName);
|
||||
},
|
||||
actions: {
|
||||
refresh() {
|
||||
this.send("triggerRefresh");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -13,6 +13,6 @@ export default {
|
||||
willDestroyElement() {
|
||||
this._super(...arguments);
|
||||
|
||||
this.appEvents.off("url:refresh", this, this.refresh);
|
||||
this.appEvents.off("url:refresh");
|
||||
}
|
||||
};
|
||||
|
@ -94,24 +94,8 @@ const DiscoveryCategoriesRoute = Discourse.Route.extend(OpenComposer, {
|
||||
},
|
||||
|
||||
actions: {
|
||||
refresh() {
|
||||
const controller = this.controllerFor("discovery/categories");
|
||||
const discController = this.controllerFor("discovery");
|
||||
|
||||
// Don't refresh if we're still loading
|
||||
if (!discController || discController.get("loading")) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If we `send('loading')` here, due to returning true it bubbles up to the
|
||||
// router and ember throws an error due to missing `handlerInfos`.
|
||||
// Lesson learned: Don't call `loading` yourself.
|
||||
discController.set("loading", true);
|
||||
|
||||
this.model().then(model => {
|
||||
this.setupController(controller, model);
|
||||
controller.send("loadingComplete");
|
||||
});
|
||||
triggerRefresh() {
|
||||
this.refresh();
|
||||
},
|
||||
|
||||
createCategory() {
|
||||
|
@ -1,4 +1,4 @@
|
||||
{{#discovery-categories refresh=refresh}}
|
||||
{{#discovery-categories refresh=(action "refresh")}}
|
||||
{{component categoryPageStyle
|
||||
categories=model.categories
|
||||
latestTopicOnly=latestTopicOnly
|
||||
|
@ -1,4 +1,4 @@
|
||||
{{#discovery-categories refresh=refresh}}
|
||||
{{#discovery-categories refresh=(action "refresh")}}
|
||||
{{component categoryPageStyle
|
||||
categories=model.categories
|
||||
latestTopicOnly=latestTopicOnly
|
||||
|
Loading…
x
Reference in New Issue
Block a user