mirror of
https://github.com/flarum/framework.git
synced 2024-12-12 14:13:37 +08:00
Ensure the correct relationship values are returned
This commit is contained in:
parent
e2cb9762fe
commit
516569e2e9
|
@ -225,7 +225,9 @@ export default class Model {
|
||||||
if (this.data.relationships) {
|
if (this.data.relationships) {
|
||||||
const relationship = this.data.relationships[name];
|
const relationship = this.data.relationships[name];
|
||||||
|
|
||||||
return relationship && app.store.getById(relationship.data.type, relationship.data.id);
|
if (relationship) {
|
||||||
|
return app.store.getById(relationship.data.type, relationship.data.id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -247,7 +249,9 @@ export default class Model {
|
||||||
if (this.data.relationships) {
|
if (this.data.relationships) {
|
||||||
const relationship = this.data.relationships[name];
|
const relationship = this.data.relationships[name];
|
||||||
|
|
||||||
return relationship && relationship.data.map(data => app.store.getById(data.type, data.id));
|
if (relationship) {
|
||||||
|
return relationship.data.map(data => app.store.getById(data.type, data.id));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user