From 7a01b43bec15de96cff183dfd18c4a51f7c14bf2 Mon Sep 17 00:00:00 2001 From: Sendou Date: Fri, 10 Jan 2020 01:12:10 +0200 Subject: [PATCH] vouches can't see suggestions/vouches --- frontend-react/src/components/plus/Suggestions.js | 1 + graphql-schemas/plus.js | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/frontend-react/src/components/plus/Suggestions.js b/frontend-react/src/components/plus/Suggestions.js index f0ef614fb..59688d6a8 100644 --- a/frontend-react/src/components/plus/Suggestions.js +++ b/frontend-react/src/components/plus/Suggestions.js @@ -78,6 +78,7 @@ const Suggestions = ({ if (loading || vouchesLoading) return if (error) return if (vouchesError) return + if (!data.suggestions) return null const ownSuggestion = data.suggestions.find( suggestion => diff --git a/graphql-schemas/plus.js b/graphql-schemas/plus.js index e051787d0..df7f6d1b9 100644 --- a/graphql-schemas/plus.js +++ b/graphql-schemas/plus.js @@ -14,7 +14,7 @@ const typeDef = gql` extend type Query { plusInfo: PlusGeneralInfo hasAccess(discord_id: String!, server: String!): Boolean! - suggestions: [Suggested!]! + suggestions: [Suggested!] vouches: [User!] usersForVoting: UsersForVoting! summaries: [Summary!] @@ -275,7 +275,8 @@ const resolvers = { return { users, suggested, votes } }, suggestions: (root, args, ctx) => { - if (!ctx.user || !ctx.user.plus) return null + if (!ctx.user || !ctx.user.plus || !ctx.user.plus.membership_status) + return null const searchCriteria = ctx.user.plus.membership_status === "ONE" ? {} : { plus_server: "TWO" } return Suggested.find(searchCriteria) @@ -289,7 +290,7 @@ const resolvers = { }) }, vouches: (root, args, { user }) => { - if (!user || !user.plus) return null + if (!user || !user.plus || !user.plus.membership_status) return null const searchCriteria = user.plus.membership_status === "ONE" ? { "plus.vouch_status": { $ne: null } }