mirror of
https://github.com/wassname/talk.git
synced 2026-07-31 12:50:48 +08:00
chore: rename accept comment to approve comment (#2341)
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
import TenantContext from "coral-server/graph/tenant/context";
|
||||
import { accept, reject } from "coral-server/services/comments/moderation";
|
||||
import { approve, reject } from "coral-server/services/comments/moderation";
|
||||
import {
|
||||
GQLAcceptCommentInput,
|
||||
GQLApproveCommentInput,
|
||||
GQLRejectCommentInput,
|
||||
} from "../schema/__generated__/types";
|
||||
|
||||
export const Actions = (ctx: TenantContext) => ({
|
||||
acceptComment: (input: GQLAcceptCommentInput) =>
|
||||
accept(ctx.mongo, ctx.redis, ctx.tenant, {
|
||||
approveComment: (input: GQLApproveCommentInput) =>
|
||||
approve(ctx.mongo, ctx.redis, ctx.tenant, {
|
||||
commentID: input.commentID,
|
||||
commentRevisionID: input.commentRevisionID,
|
||||
moderatorID: ctx.user!.id,
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
import { GQLAcceptCommentPayloadTypeResolver } from "coral-server/graph/tenant/schema/__generated__/types";
|
||||
|
||||
import { moderationQueuesResolver } from "./ModerationQueues";
|
||||
|
||||
export const AcceptCommentPayload: GQLAcceptCommentPayloadTypeResolver = {
|
||||
moderationQueues: moderationQueuesResolver,
|
||||
};
|
||||
@@ -0,0 +1,7 @@
|
||||
import { GQLApproveCommentPayloadTypeResolver } from "coral-server/graph/tenant/schema/__generated__/types";
|
||||
|
||||
import { moderationQueuesResolver } from "./ModerationQueues";
|
||||
|
||||
export const ApproveCommentPayload: GQLApproveCommentPayloadTypeResolver = {
|
||||
moderationQueues: moderationQueuesResolver,
|
||||
};
|
||||
@@ -1,5 +1,5 @@
|
||||
import {
|
||||
AcceptCommentPayloadToModerationQueuesResolver,
|
||||
ApproveCommentPayloadToModerationQueuesResolver,
|
||||
GQLModerationQueuesTypeResolver,
|
||||
QueryToModerationQueuesResolver,
|
||||
RejectCommentPayloadToModerationQueuesResolver,
|
||||
@@ -89,7 +89,7 @@ export const sharedModerationInputResolver = async (
|
||||
*/
|
||||
export const moderationQueuesResolver:
|
||||
| QueryToModerationQueuesResolver
|
||||
| AcceptCommentPayloadToModerationQueuesResolver
|
||||
| ApproveCommentPayloadToModerationQueuesResolver
|
||||
| RejectCommentPayloadToModerationQueuesResolver = async (
|
||||
source,
|
||||
args,
|
||||
|
||||
@@ -83,8 +83,8 @@ export const Mutation: Required<GQLMutationTypeResolver<void>> = {
|
||||
story: await ctx.mutators.Stories.scrape(input),
|
||||
clientMutationId: input.clientMutationId,
|
||||
}),
|
||||
acceptComment: async (source, { input }, ctx) => ({
|
||||
comment: await ctx.mutators.Actions.acceptComment(input),
|
||||
approveComment: async (source, { input }, ctx) => ({
|
||||
comment: await ctx.mutators.Actions.approveComment(input),
|
||||
clientMutationId: input.clientMutationId,
|
||||
}),
|
||||
rejectComment: async (source, { input }, ctx) => ({
|
||||
|
||||
@@ -2,7 +2,7 @@ import Cursor from "coral-server/graph/common/scalars/cursor";
|
||||
import Time from "coral-server/graph/common/scalars/time";
|
||||
import { GQLResolver } from "coral-server/graph/tenant/schema/__generated__/types";
|
||||
|
||||
import { AcceptCommentPayload } from "./AcceptCommentPayload";
|
||||
import { ApproveCommentPayload } from "./ApproveCommentPayload";
|
||||
import { AuthIntegrations } from "./AuthIntegrations";
|
||||
import { BanStatus } from "./BanStatus";
|
||||
import { BanStatusHistory } from "./BanStatusHistory";
|
||||
@@ -31,7 +31,7 @@ import { User } from "./User";
|
||||
import { UserStatus } from "./UserStatus";
|
||||
|
||||
const Resolvers: GQLResolver = {
|
||||
AcceptCommentPayload,
|
||||
ApproveCommentPayload,
|
||||
AuthIntegrations,
|
||||
BanStatus,
|
||||
BanStatusHistory,
|
||||
|
||||
@@ -1560,9 +1560,9 @@ enum COMMENT_STATUS {
|
||||
NONE
|
||||
|
||||
"""
|
||||
The comment has been accepted by a moderator.
|
||||
The comment has been approved by a moderator.
|
||||
"""
|
||||
ACCEPTED
|
||||
APPROVED
|
||||
|
||||
"""
|
||||
The comment has been rejected by a moderator.
|
||||
@@ -1894,9 +1894,9 @@ type CommentStatusCounts {
|
||||
NONE: Int!
|
||||
|
||||
"""
|
||||
The comment has been accepted by a moderator.
|
||||
The comment has been approved by a moderator.
|
||||
"""
|
||||
ACCEPTED: Int!
|
||||
APPROVED: Int!
|
||||
|
||||
"""
|
||||
The comment has been rejected by a moderator.
|
||||
@@ -3516,17 +3516,17 @@ type ScrapeStoryPayload {
|
||||
}
|
||||
|
||||
##################
|
||||
# acceptComment
|
||||
# approveComment
|
||||
##################
|
||||
|
||||
input AcceptCommentInput {
|
||||
input ApproveCommentInput {
|
||||
"""
|
||||
commentID is the ID of the Comment that was accepted.
|
||||
commentID is the ID of the Comment that was approved.
|
||||
"""
|
||||
commentID: ID!
|
||||
|
||||
"""
|
||||
commentRevisionID is the ID of the CommentRevision that is being accepted.
|
||||
commentRevisionID is the ID of the CommentRevision that is being approved.
|
||||
"""
|
||||
commentRevisionID: ID!
|
||||
|
||||
@@ -3536,9 +3536,9 @@ input AcceptCommentInput {
|
||||
clientMutationId: String!
|
||||
}
|
||||
|
||||
type AcceptCommentPayload {
|
||||
type ApproveCommentPayload {
|
||||
"""
|
||||
comment is the Comment that was accepted.
|
||||
comment is the Comment that was approved.
|
||||
"""
|
||||
comment: Comment
|
||||
|
||||
@@ -4213,9 +4213,9 @@ type Mutation {
|
||||
@auth(roles: [ADMIN, MODERATOR])
|
||||
|
||||
"""
|
||||
acceptComment will mark the Comment as ACCEPTED.
|
||||
approveComment will mark the Comment as APPROVED.
|
||||
"""
|
||||
acceptComment(input: AcceptCommentInput!): AcceptCommentPayload!
|
||||
approveComment(input: ApproveCommentInput!): ApproveCommentPayload!
|
||||
@auth(roles: [MODERATOR, ADMIN])
|
||||
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user