diff --git a/src/graphql/operations/proposals.ts b/src/graphql/operations/proposals.ts index eee59b11..b9c9e5f1 100644 --- a/src/graphql/operations/proposals.ts +++ b/src/graphql/operations/proposals.ts @@ -1,7 +1,7 @@ import db from '../../helpers/mysql'; import { buildWhereQuery, formatProposal, checkLimits } from '../helpers'; import log from '../../helpers/log'; -import { verifiedSpaces } from '../../helpers/moderation'; +import { flaggedProposals, verifiedSpaces } from '../../helpers/moderation'; import { capture } from '@snapshot-labs/snapshot-sentry'; export default async function (parent, args) { @@ -65,6 +65,16 @@ export default async function (parent, args) { params.push(verifiedSpaces); } + if (where.flagged === true) { + searchSql += ' AND p.id IN (?)'; + params.push(flaggedProposals); + } + + if (where.flagged === false) { + searchSql += ' AND p.id NOT IN (?)'; + params.push(flaggedProposals); + } + let orderBy = args.orderBy || 'created'; let orderDirection = args.orderDirection || 'desc'; if (!['created', 'start', 'end'].includes(orderBy)) orderBy = 'created'; diff --git a/src/graphql/schema.gql b/src/graphql/schema.gql index e1c2ba62..e2d954f9 100644 --- a/src/graphql/schema.gql +++ b/src/graphql/schema.gql @@ -200,6 +200,7 @@ input ProposalWhere { scores_state_in: [String] state: String space_verified: Boolean + flagged: Boolean } input VoteWhere {