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:
Bianca Nenciu 2024-02-21 20:08:47 +02:00 committed by GitHub
parent 13291dc5ef
commit 47623e1214
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 0 deletions

View File

@ -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(() =>

View File

@ -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(() =>