forked from DebaucheryLibrarian/traxxx
Fixed stashed check breaking on empty stashes in PostGraphile plugins.
This commit is contained in:
parent
76a5ccf3f6
commit
c70f500acc
|
@ -25,14 +25,14 @@ const schemaExtender = makeExtendSchemaPlugin(_build => ({
|
|||
resolvers: {
|
||||
Actor: {
|
||||
isFavorited(parent) {
|
||||
if (!parent['@stashes'] || typeof parent['@stashes'][0]['@stash'].primary === 'undefined') {
|
||||
if (!parent['@stashes'] || (parent['@stashes'].length > 0 && typeof parent['@stashes'][0]['@stash'].primary === 'undefined')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return parent['@stashes'].some(({ '@stash': stash }) => stash.primary);
|
||||
},
|
||||
isStashed(parent, args) {
|
||||
if (!parent['@stashes'] || typeof parent['@stashes'][0]['@stash'].primary === 'undefined') {
|
||||
if (!parent['@stashes'] || (parent['@stashes'].length > 0 && typeof parent['@stashes'][0]['@stash'].primary === 'undefined')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,14 +12,14 @@ const schemaExtender = makeExtendSchemaPlugin(_build => ({
|
|||
resolvers: {
|
||||
Release: {
|
||||
isFavorited(parent) {
|
||||
if (!parent['@stashes'] || typeof parent['@stashes'][0]['@stash'].primary === 'undefined') {
|
||||
if (!parent['@stashes'] || (parent['@stashes'].length > 0 && typeof parent['@stashes'][0]['@stash'].primary === 'undefined')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return parent['@stashes'].some(({ '@stash': stash }) => stash.primary);
|
||||
},
|
||||
isStashed(parent, args) {
|
||||
if (!parent['@stashes'] || typeof parent['@stashes'][0]['@stash'].primary === 'undefined') {
|
||||
if (!parent['@stashes'] || (parent['@stashes'].length > 0 && typeof parent['@stashes'][0]['@stash'].primary === 'undefined')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue