DEV: Fix a computed property override (#239)

This commit is contained in:
Jarek Radosz 2021-11-15 00:41:30 +01:00 committed by GitHub
parent 5fc1dee14d
commit ab0c63b1fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 15 deletions

View File

@ -1,6 +1,5 @@
import UserTopicsList from "discourse/controllers/user-topics-list";
import { alias } from "@ember/object/computed";
import discourseComputed from "discourse-common/utils/decorators";
import { alias, readOnly } from "@ember/object/computed";
import discourseDebounce from "discourse-common/lib/debounce";
import { INPUT_DELAY } from "discourse-common/config/environment";
import { inject as controller } from "@ember/controller";
@ -19,10 +18,7 @@ export default UserTopicsList.extend({
queryParams: ["order", "ascending", "search"],
@discourseComputed("search")
searchTerm(search) {
return search;
},
searchTerm: readOnly("search"),
_setSearchTerm(searchTerm) {
this.set("search", searchTerm);

View File

@ -8,6 +8,7 @@ import { action } from "@ember/object";
import getURL from "discourse-common/lib/get-url";
import { iconHTML } from "discourse-common/lib/icon-library";
import I18n from "I18n";
import { readOnly } from "@ember/object/computed";
export default UserTopicsList.extend({
user: controller(),
@ -17,9 +18,11 @@ export default UserTopicsList.extend({
ascending: false,
search: "",
@discourseComputed("search")
searchTerm(search) {
return search;
searchTerm: readOnly("search"),
_setSearchTerm(searchTerm) {
this.set("search", searchTerm);
this.refreshModel();
},
@discourseComputed("model.topics.length", "search")
@ -35,11 +38,6 @@ export default UserTopicsList.extend({
}).htmlSafe();
},
_setSearchTerm(searchTerm) {
this.set("search", searchTerm);
this.refreshModel();
},
refreshModel() {
this.set("loading", true);
this.store

View File

@ -39,7 +39,7 @@ export default DiscourseRoute.extend({
setupController(controller, model) {
controller.setProperties({
model,
searchTerm: this.currentModel.params.search,
search: this.currentModel.params.search,
});
},