mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 13:03:39 +08:00
FIX: Ensure model properties are set (#25790)
New models do not have all properties set yet which caused issues when trying to access them.
This commit is contained in:
parent
13291dc5ef
commit
47623e1214
|
@ -223,6 +223,7 @@ export default class Group extends RestModel {
|
|||
get watchingCategories() {
|
||||
if (
|
||||
this.site.lazy_load_categories &&
|
||||
this.watching_category_ids &&
|
||||
!Category.hasAsyncFoundAll(this.watching_category_ids)
|
||||
) {
|
||||
Category.asyncFindByIds(this.watching_category_ids).then(() =>
|
||||
|
@ -244,6 +245,7 @@ export default class Group extends RestModel {
|
|||
get trackingCategories() {
|
||||
if (
|
||||
this.site.lazy_load_categories &&
|
||||
this.tracking_category_ids &&
|
||||
!Category.hasAsyncFoundAll(this.tracking_category_ids)
|
||||
) {
|
||||
Category.asyncFindByIds(this.tracking_category_ids).then(() =>
|
||||
|
@ -265,6 +267,7 @@ export default class Group extends RestModel {
|
|||
get watchingFirstPostCategories() {
|
||||
if (
|
||||
this.site.lazy_load_categories &&
|
||||
this.watching_first_post_category_ids &&
|
||||
!Category.hasAsyncFoundAll(this.watching_first_post_category_ids)
|
||||
) {
|
||||
Category.asyncFindByIds(this.watching_first_post_category_ids).then(() =>
|
||||
|
@ -286,6 +289,7 @@ export default class Group extends RestModel {
|
|||
get regularCategories() {
|
||||
if (
|
||||
this.site.lazy_load_categories &&
|
||||
this.regular_category_ids &&
|
||||
!Category.hasAsyncFoundAll(this.regular_category_ids)
|
||||
) {
|
||||
Category.asyncFindByIds(this.regular_category_ids).then(() =>
|
||||
|
@ -307,6 +311,7 @@ export default class Group extends RestModel {
|
|||
get mutedCategories() {
|
||||
if (
|
||||
this.site.lazy_load_categories &&
|
||||
this.muted_category_ids &&
|
||||
!Category.hasAsyncFoundAll(this.muted_category_ids)
|
||||
) {
|
||||
Category.asyncFindByIds(this.muted_category_ids).then(() =>
|
||||
|
|
|
@ -845,6 +845,7 @@ export default class User extends RestModel.extend(Evented) {
|
|||
get mutedCategories() {
|
||||
if (
|
||||
this.site.lazy_load_categories &&
|
||||
this.muted_category_ids &&
|
||||
!Category.hasAsyncFoundAll(this.muted_category_ids)
|
||||
) {
|
||||
Category.asyncFindByIds(this.muted_category_ids).then(() =>
|
||||
|
@ -866,6 +867,7 @@ export default class User extends RestModel.extend(Evented) {
|
|||
get regularCategories() {
|
||||
if (
|
||||
this.site.lazy_load_categories &&
|
||||
this.regular_category_ids &&
|
||||
!Category.hasAsyncFoundAll(this.regular_category_ids)
|
||||
) {
|
||||
Category.asyncFindByIds(this.regular_category_ids).then(() =>
|
||||
|
@ -887,6 +889,7 @@ export default class User extends RestModel.extend(Evented) {
|
|||
get trackedCategories() {
|
||||
if (
|
||||
this.site.lazy_load_categories &&
|
||||
this.tracked_category_ids &&
|
||||
!Category.hasAsyncFoundAll(this.tracked_category_ids)
|
||||
) {
|
||||
Category.asyncFindByIds(this.tracked_category_ids).then(() =>
|
||||
|
@ -908,6 +911,7 @@ export default class User extends RestModel.extend(Evented) {
|
|||
get watchedCategories() {
|
||||
if (
|
||||
this.site.lazy_load_categories &&
|
||||
this.watched_category_ids &&
|
||||
!Category.hasAsyncFoundAll(this.watched_category_ids)
|
||||
) {
|
||||
Category.asyncFindByIds(this.watched_category_ids).then(() =>
|
||||
|
@ -929,6 +933,7 @@ export default class User extends RestModel.extend(Evented) {
|
|||
get watchedFirstPostCategories() {
|
||||
if (
|
||||
this.site.lazy_load_categories &&
|
||||
this.watched_first_post_category_ids &&
|
||||
!Category.hasAsyncFoundAll(this.watched_first_post_category_ids)
|
||||
) {
|
||||
Category.asyncFindByIds(this.watched_first_post_category_ids).then(() =>
|
||||
|
|
Loading…
Reference in New Issue
Block a user