DEV: Fix a computed property override (#239)
This commit is contained in:
parent
5fc1dee14d
commit
ab0c63b1fb
|
@ -1,6 +1,5 @@
|
||||||
import UserTopicsList from "discourse/controllers/user-topics-list";
|
import UserTopicsList from "discourse/controllers/user-topics-list";
|
||||||
import { alias } from "@ember/object/computed";
|
import { alias, readOnly } from "@ember/object/computed";
|
||||||
import discourseComputed from "discourse-common/utils/decorators";
|
|
||||||
import discourseDebounce from "discourse-common/lib/debounce";
|
import discourseDebounce from "discourse-common/lib/debounce";
|
||||||
import { INPUT_DELAY } from "discourse-common/config/environment";
|
import { INPUT_DELAY } from "discourse-common/config/environment";
|
||||||
import { inject as controller } from "@ember/controller";
|
import { inject as controller } from "@ember/controller";
|
||||||
|
@ -19,10 +18,7 @@ export default UserTopicsList.extend({
|
||||||
|
|
||||||
queryParams: ["order", "ascending", "search"],
|
queryParams: ["order", "ascending", "search"],
|
||||||
|
|
||||||
@discourseComputed("search")
|
searchTerm: readOnly("search"),
|
||||||
searchTerm(search) {
|
|
||||||
return search;
|
|
||||||
},
|
|
||||||
|
|
||||||
_setSearchTerm(searchTerm) {
|
_setSearchTerm(searchTerm) {
|
||||||
this.set("search", searchTerm);
|
this.set("search", searchTerm);
|
||||||
|
|
|
@ -8,6 +8,7 @@ import { action } from "@ember/object";
|
||||||
import getURL from "discourse-common/lib/get-url";
|
import getURL from "discourse-common/lib/get-url";
|
||||||
import { iconHTML } from "discourse-common/lib/icon-library";
|
import { iconHTML } from "discourse-common/lib/icon-library";
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
|
import { readOnly } from "@ember/object/computed";
|
||||||
|
|
||||||
export default UserTopicsList.extend({
|
export default UserTopicsList.extend({
|
||||||
user: controller(),
|
user: controller(),
|
||||||
|
@ -17,9 +18,11 @@ export default UserTopicsList.extend({
|
||||||
ascending: false,
|
ascending: false,
|
||||||
search: "",
|
search: "",
|
||||||
|
|
||||||
@discourseComputed("search")
|
searchTerm: readOnly("search"),
|
||||||
searchTerm(search) {
|
|
||||||
return search;
|
_setSearchTerm(searchTerm) {
|
||||||
|
this.set("search", searchTerm);
|
||||||
|
this.refreshModel();
|
||||||
},
|
},
|
||||||
|
|
||||||
@discourseComputed("model.topics.length", "search")
|
@discourseComputed("model.topics.length", "search")
|
||||||
|
@ -35,11 +38,6 @@ export default UserTopicsList.extend({
|
||||||
}).htmlSafe();
|
}).htmlSafe();
|
||||||
},
|
},
|
||||||
|
|
||||||
_setSearchTerm(searchTerm) {
|
|
||||||
this.set("search", searchTerm);
|
|
||||||
this.refreshModel();
|
|
||||||
},
|
|
||||||
|
|
||||||
refreshModel() {
|
refreshModel() {
|
||||||
this.set("loading", true);
|
this.set("loading", true);
|
||||||
this.store
|
this.store
|
||||||
|
|
|
@ -39,7 +39,7 @@ export default DiscourseRoute.extend({
|
||||||
setupController(controller, model) {
|
setupController(controller, model) {
|
||||||
controller.setProperties({
|
controller.setProperties({
|
||||||
model,
|
model,
|
||||||
searchTerm: this.currentModel.params.search,
|
search: this.currentModel.params.search,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue