mirror of
https://github.com/discourse/discourse.git
synced 2025-06-11 09:16:30 +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:
@ -223,6 +223,7 @@ export default class Group extends RestModel {
|
|||||||
get watchingCategories() {
|
get watchingCategories() {
|
||||||
if (
|
if (
|
||||||
this.site.lazy_load_categories &&
|
this.site.lazy_load_categories &&
|
||||||
|
this.watching_category_ids &&
|
||||||
!Category.hasAsyncFoundAll(this.watching_category_ids)
|
!Category.hasAsyncFoundAll(this.watching_category_ids)
|
||||||
) {
|
) {
|
||||||
Category.asyncFindByIds(this.watching_category_ids).then(() =>
|
Category.asyncFindByIds(this.watching_category_ids).then(() =>
|
||||||
@ -244,6 +245,7 @@ export default class Group extends RestModel {
|
|||||||
get trackingCategories() {
|
get trackingCategories() {
|
||||||
if (
|
if (
|
||||||
this.site.lazy_load_categories &&
|
this.site.lazy_load_categories &&
|
||||||
|
this.tracking_category_ids &&
|
||||||
!Category.hasAsyncFoundAll(this.tracking_category_ids)
|
!Category.hasAsyncFoundAll(this.tracking_category_ids)
|
||||||
) {
|
) {
|
||||||
Category.asyncFindByIds(this.tracking_category_ids).then(() =>
|
Category.asyncFindByIds(this.tracking_category_ids).then(() =>
|
||||||
@ -265,6 +267,7 @@ export default class Group extends RestModel {
|
|||||||
get watchingFirstPostCategories() {
|
get watchingFirstPostCategories() {
|
||||||
if (
|
if (
|
||||||
this.site.lazy_load_categories &&
|
this.site.lazy_load_categories &&
|
||||||
|
this.watching_first_post_category_ids &&
|
||||||
!Category.hasAsyncFoundAll(this.watching_first_post_category_ids)
|
!Category.hasAsyncFoundAll(this.watching_first_post_category_ids)
|
||||||
) {
|
) {
|
||||||
Category.asyncFindByIds(this.watching_first_post_category_ids).then(() =>
|
Category.asyncFindByIds(this.watching_first_post_category_ids).then(() =>
|
||||||
@ -286,6 +289,7 @@ export default class Group extends RestModel {
|
|||||||
get regularCategories() {
|
get regularCategories() {
|
||||||
if (
|
if (
|
||||||
this.site.lazy_load_categories &&
|
this.site.lazy_load_categories &&
|
||||||
|
this.regular_category_ids &&
|
||||||
!Category.hasAsyncFoundAll(this.regular_category_ids)
|
!Category.hasAsyncFoundAll(this.regular_category_ids)
|
||||||
) {
|
) {
|
||||||
Category.asyncFindByIds(this.regular_category_ids).then(() =>
|
Category.asyncFindByIds(this.regular_category_ids).then(() =>
|
||||||
@ -307,6 +311,7 @@ export default class Group extends RestModel {
|
|||||||
get mutedCategories() {
|
get mutedCategories() {
|
||||||
if (
|
if (
|
||||||
this.site.lazy_load_categories &&
|
this.site.lazy_load_categories &&
|
||||||
|
this.muted_category_ids &&
|
||||||
!Category.hasAsyncFoundAll(this.muted_category_ids)
|
!Category.hasAsyncFoundAll(this.muted_category_ids)
|
||||||
) {
|
) {
|
||||||
Category.asyncFindByIds(this.muted_category_ids).then(() =>
|
Category.asyncFindByIds(this.muted_category_ids).then(() =>
|
||||||
|
@ -845,6 +845,7 @@ export default class User extends RestModel.extend(Evented) {
|
|||||||
get mutedCategories() {
|
get mutedCategories() {
|
||||||
if (
|
if (
|
||||||
this.site.lazy_load_categories &&
|
this.site.lazy_load_categories &&
|
||||||
|
this.muted_category_ids &&
|
||||||
!Category.hasAsyncFoundAll(this.muted_category_ids)
|
!Category.hasAsyncFoundAll(this.muted_category_ids)
|
||||||
) {
|
) {
|
||||||
Category.asyncFindByIds(this.muted_category_ids).then(() =>
|
Category.asyncFindByIds(this.muted_category_ids).then(() =>
|
||||||
@ -866,6 +867,7 @@ export default class User extends RestModel.extend(Evented) {
|
|||||||
get regularCategories() {
|
get regularCategories() {
|
||||||
if (
|
if (
|
||||||
this.site.lazy_load_categories &&
|
this.site.lazy_load_categories &&
|
||||||
|
this.regular_category_ids &&
|
||||||
!Category.hasAsyncFoundAll(this.regular_category_ids)
|
!Category.hasAsyncFoundAll(this.regular_category_ids)
|
||||||
) {
|
) {
|
||||||
Category.asyncFindByIds(this.regular_category_ids).then(() =>
|
Category.asyncFindByIds(this.regular_category_ids).then(() =>
|
||||||
@ -887,6 +889,7 @@ export default class User extends RestModel.extend(Evented) {
|
|||||||
get trackedCategories() {
|
get trackedCategories() {
|
||||||
if (
|
if (
|
||||||
this.site.lazy_load_categories &&
|
this.site.lazy_load_categories &&
|
||||||
|
this.tracked_category_ids &&
|
||||||
!Category.hasAsyncFoundAll(this.tracked_category_ids)
|
!Category.hasAsyncFoundAll(this.tracked_category_ids)
|
||||||
) {
|
) {
|
||||||
Category.asyncFindByIds(this.tracked_category_ids).then(() =>
|
Category.asyncFindByIds(this.tracked_category_ids).then(() =>
|
||||||
@ -908,6 +911,7 @@ export default class User extends RestModel.extend(Evented) {
|
|||||||
get watchedCategories() {
|
get watchedCategories() {
|
||||||
if (
|
if (
|
||||||
this.site.lazy_load_categories &&
|
this.site.lazy_load_categories &&
|
||||||
|
this.watched_category_ids &&
|
||||||
!Category.hasAsyncFoundAll(this.watched_category_ids)
|
!Category.hasAsyncFoundAll(this.watched_category_ids)
|
||||||
) {
|
) {
|
||||||
Category.asyncFindByIds(this.watched_category_ids).then(() =>
|
Category.asyncFindByIds(this.watched_category_ids).then(() =>
|
||||||
@ -929,6 +933,7 @@ export default class User extends RestModel.extend(Evented) {
|
|||||||
get watchedFirstPostCategories() {
|
get watchedFirstPostCategories() {
|
||||||
if (
|
if (
|
||||||
this.site.lazy_load_categories &&
|
this.site.lazy_load_categories &&
|
||||||
|
this.watched_first_post_category_ids &&
|
||||||
!Category.hasAsyncFoundAll(this.watched_first_post_category_ids)
|
!Category.hasAsyncFoundAll(this.watched_first_post_category_ids)
|
||||||
) {
|
) {
|
||||||
Category.asyncFindByIds(this.watched_first_post_category_ids).then(() =>
|
Category.asyncFindByIds(this.watched_first_post_category_ids).then(() =>
|
||||||
|
Reference in New Issue
Block a user