vouches can't see suggestions/vouches

This commit is contained in:
Sendou 2020-01-10 01:12:10 +02:00
parent 079d0bf4e4
commit 7a01b43bec
2 changed files with 5 additions and 3 deletions

View File

@ -78,6 +78,7 @@ const Suggestions = ({
if (loading || vouchesLoading) return <Loading minHeight="250px" />
if (error) return <Error errorMessage={error.message} />
if (vouchesError) return <Error errorMessage={vouchesError.message} />
if (!data.suggestions) return null
const ownSuggestion = data.suggestions.find(
suggestion =>

View File

@ -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 } }