DEV: Replace observers in User model
This commit is contained in:
parent
fe2c3e3e38
commit
0fc944889b
|
@ -13,7 +13,7 @@ import UserStream from "discourse/models/user-stream";
|
||||||
import UserPostsStream from "discourse/models/user-posts-stream";
|
import UserPostsStream from "discourse/models/user-posts-stream";
|
||||||
import Singleton from "discourse/mixins/singleton";
|
import Singleton from "discourse/mixins/singleton";
|
||||||
import { longDate } from "discourse/lib/formatter";
|
import { longDate } from "discourse/lib/formatter";
|
||||||
import discourseComputed, { observes } from "discourse-common/utils/decorators";
|
import discourseComputed from "discourse-common/utils/decorators";
|
||||||
import Badge from "discourse/models/badge";
|
import Badge from "discourse/models/badge";
|
||||||
import UserBadge from "discourse/models/user-badge";
|
import UserBadge from "discourse/models/user-badge";
|
||||||
import UserActionStat from "discourse/models/user-action-stat";
|
import UserActionStat from "discourse/models/user-action-stat";
|
||||||
|
@ -729,41 +729,29 @@ const User = RestModel.extend({
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@observes("muted_category_ids")
|
@discourseComputed("muted_category_ids")
|
||||||
updateMutedCategories() {
|
mutedCategories(mutedCategoryIds) {
|
||||||
this.set("mutedCategories", Category.findByIds(this.muted_category_ids));
|
return Category.findByIds(mutedCategoryIds);
|
||||||
},
|
},
|
||||||
|
|
||||||
@observes("regular_category_ids")
|
@discourseComputed("regular_category_ids")
|
||||||
updateRegularCategories() {
|
regularCategories(regularCategoryIds) {
|
||||||
this.set(
|
return Category.findByIds(regularCategoryIds);
|
||||||
"regularCategories",
|
|
||||||
Category.findByIds(this.regular_category_ids)
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
@observes("tracked_category_ids")
|
@discourseComputed("tracked_category_ids")
|
||||||
updateTrackedCategories() {
|
trackedCategories(trackedCategoryIds) {
|
||||||
this.set(
|
return Category.findByIds(trackedCategoryIds);
|
||||||
"trackedCategories",
|
|
||||||
Category.findByIds(this.tracked_category_ids)
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
@observes("watched_category_ids")
|
@discourseComputed("watched_category_ids")
|
||||||
updateWatchedCategories() {
|
watchedCategories(watchedCategoryIds) {
|
||||||
this.set(
|
return Category.findByIds(watchedCategoryIds);
|
||||||
"watchedCategories",
|
|
||||||
Category.findByIds(this.watched_category_ids)
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
@observes("watched_first_post_category_ids")
|
@discourseComputed("watched_first_post_category_ids")
|
||||||
updateWatchedFirstPostCategories() {
|
watchedFirstPostCategories(wachedFirstPostCategoryIds) {
|
||||||
this.set(
|
return Category.findByIds(wachedFirstPostCategoryIds);
|
||||||
"watchedFirstPostCategories",
|
|
||||||
Category.findByIds(this.watched_first_post_category_ids)
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
@discourseComputed("can_delete_account")
|
@discourseComputed("can_delete_account")
|
||||||
|
|
Loading…
Reference in New Issue