[CORL-294] Moderate a single story + quick search (#2286)

* feat: allow passing a `storyID` to `Query.moderationQueues`

* feat: moderate by story

* feat: implement search story combobox

* feat: add translations

* fix: tests

* fix: duplicate id

* fix: rename file

* chore: add more comments

* fix: add missing translation

* review: use query parameter "q" instead of url path

* chore: move placeholder logic inside, maybe this makes it clearer :-D
This commit is contained in:
Kiwi
2019-04-26 14:23:46 +00:00
committed by Wyatt Johnson
parent a91de05af9
commit ab938985e4
86 changed files with 1934 additions and 319 deletions
@@ -13,16 +13,22 @@ let clientMutationId = 0;
const RejectCommentMutation = createMutation(
"rejectComment",
(environment: Environment, input: MutationInput<MutationTypes>) =>
(
environment: Environment,
input: MutationInput<MutationTypes> & { storyID?: string }
) =>
commitMutationPromiseNormalized<MutationTypes>(environment, {
mutation: graphql`
mutation RejectCommentMutation($input: RejectCommentInput!) {
mutation RejectCommentMutation(
$input: RejectCommentInput!
$storyID: ID
) {
rejectComment(input: $input) {
comment {
id
status
}
moderationQueues {
moderationQueues(storyID: $storyID) {
unmoderated {
count
}
@@ -39,7 +45,8 @@ const RejectCommentMutation = createMutation(
`,
variables: {
input: {
...input,
commentID: input.commentID,
commentRevisionID: input.commentRevisionID,
clientMutationId: clientMutationId.toString(),
},
},
@@ -54,9 +61,9 @@ const RejectCommentMutation = createMutation(
},
updater: store => {
const connections = [
getQueueConnection("reported", store),
getQueueConnection("pending", store),
getQueueConnection("unmoderated", store),
getQueueConnection(store, "reported", input.storyID),
getQueueConnection(store, "pending", input.storyID),
getQueueConnection(store, "unmoderated", input.storyID),
].filter(c => c);
connections.forEach(con =>
ConnectionHandler.deleteNode(con, input.commentID)