mirror of
https://github.com/wassname/talk.git
synced 2026-07-29 11:28:24 +08:00
[CORL-623] add live updates for comments moving from premod to approved (#2571)
* add live updates for comments moving from premod to approved * rename disposables * check if comment is system withheld as well as premod to publish event
This commit is contained in:
committed by
Wyatt Johnson
parent
e4bfbbc1f8
commit
b3064c89de
@@ -0,0 +1,11 @@
|
||||
import { GQLCommentReleasedPayloadTypeResolver } from "coral-server/graph/tenant/schema/__generated__/types";
|
||||
|
||||
import { maybeLoadOnlyID } from "./Comment";
|
||||
import { CommentReleasedInput } from "./Subscription/commentReleased";
|
||||
|
||||
export const CommentReleasedPayload: GQLCommentReleasedPayloadTypeResolver<
|
||||
CommentReleasedInput
|
||||
> = {
|
||||
comment: ({ commentID }, args, ctx, info) =>
|
||||
maybeLoadOnlyID(ctx, info, commentID),
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
import { SubscriptionToCommentReleasedResolver } from "coral-server/graph/tenant/schema/__generated__/types";
|
||||
|
||||
import { createIterator } from "./helpers";
|
||||
import {
|
||||
SUBSCRIPTION_CHANNELS,
|
||||
SubscriptionPayload,
|
||||
SubscriptionType,
|
||||
} from "./types";
|
||||
|
||||
export interface CommentReleasedInput extends SubscriptionPayload {
|
||||
storyID: string;
|
||||
commentID: string;
|
||||
}
|
||||
|
||||
export type CommentReleasedSubscription = SubscriptionType<
|
||||
SUBSCRIPTION_CHANNELS.COMMENT_RELEASED,
|
||||
CommentReleasedInput
|
||||
>;
|
||||
|
||||
export const commentReleased: SubscriptionToCommentReleasedResolver<
|
||||
CommentReleasedInput
|
||||
> = createIterator(SUBSCRIPTION_CHANNELS.COMMENT_RELEASED, {
|
||||
filter: (source, { storyID }) => {
|
||||
if (source.storyID !== storyID) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
});
|
||||
@@ -4,6 +4,7 @@ import { commentCreated } from "./commentCreated";
|
||||
import { commentEnteredModerationQueue } from "./commentEnteredModerationQueue";
|
||||
import { commentFeatured } from "./commentFeatured";
|
||||
import { commentLeftModerationQueue } from "./commentLeftModerationQueue";
|
||||
import { commentReleased } from "./commentReleased";
|
||||
import { commentReplyCreated } from "./commentReplyCreated";
|
||||
import { commentStatusUpdated } from "./commentStatusUpdated";
|
||||
|
||||
@@ -14,4 +15,5 @@ export const Subscription: GQLSubscriptionTypeResolver = {
|
||||
commentReplyCreated,
|
||||
commentStatusUpdated,
|
||||
commentFeatured,
|
||||
commentReleased,
|
||||
};
|
||||
|
||||
@@ -2,6 +2,7 @@ import { CommentCreatedSubscription } from "./commentCreated";
|
||||
import { CommentEnteredModerationQueueSubscription } from "./commentEnteredModerationQueue";
|
||||
import { CommentFeaturedSubscription } from "./commentFeatured";
|
||||
import { CommentLeftModerationQueueSubscription } from "./commentLeftModerationQueue";
|
||||
import { CommentReleasedSubscription } from "./commentReleased";
|
||||
import { CommentReplyCreatedSubscription } from "./commentReplyCreated";
|
||||
import { CommentStatusUpdatedSubscription } from "./commentStatusUpdated";
|
||||
|
||||
@@ -12,6 +13,7 @@ export enum SUBSCRIPTION_CHANNELS {
|
||||
COMMENT_REPLY_CREATED = "COMMENT_REPLY_CREATED",
|
||||
COMMENT_CREATED = "COMMENT_CREATED",
|
||||
COMMENT_FEATURED = "COMMENT_FEATURED",
|
||||
COMMENT_RELEASED = "COMMENT_RELEASED",
|
||||
}
|
||||
|
||||
export interface SubscriptionPayload {
|
||||
@@ -32,4 +34,5 @@ export type SUBSCRIPTION_INPUT =
|
||||
| CommentStatusUpdatedSubscription
|
||||
| CommentReplyCreatedSubscription
|
||||
| CommentCreatedSubscription
|
||||
| CommentFeaturedSubscription;
|
||||
| CommentFeaturedSubscription
|
||||
| CommentReleasedSubscription;
|
||||
|
||||
@@ -14,6 +14,7 @@ import { CommentCreatedPayload } from "./CommentCreatedPayload";
|
||||
import { CommentEnteredModerationQueuePayload } from "./CommentEnteredModerationQueuePayload";
|
||||
import { CommentLeftModerationQueuePayload } from "./CommentLeftModerationQueuePayload";
|
||||
import { CommentModerationAction } from "./CommentModerationAction";
|
||||
import { CommentReleasedPayload } from "./CommentReleasedPayload";
|
||||
import { CommentReplyCreatedPayload } from "./CommentReplyCreatedPayload";
|
||||
import { CommentRevision } from "./CommentRevision";
|
||||
import { CommentStatusUpdatedPayload } from "./CommentStatusUpdatedPayload";
|
||||
@@ -52,6 +53,7 @@ const Resolvers: GQLResolver = {
|
||||
Comment,
|
||||
CommentCounts,
|
||||
CommentCreatedPayload,
|
||||
CommentReleasedPayload,
|
||||
CommentEnteredModerationQueuePayload,
|
||||
CommentLeftModerationQueuePayload,
|
||||
CommentModerationAction,
|
||||
|
||||
@@ -5321,6 +5321,16 @@ type CommentFeaturedPayload {
|
||||
comment: Comment!
|
||||
}
|
||||
|
||||
"""
|
||||
CommentReleasedPayload is returned when a new top level Comment is approved from premod stream
|
||||
"""
|
||||
type CommentReleasedPayload {
|
||||
"""
|
||||
comment is the new top level Comment that was approved on the Story.
|
||||
"""
|
||||
comment: Comment!
|
||||
}
|
||||
|
||||
type Subscription {
|
||||
"""
|
||||
commentEnteredModerationQueue returns when a Comment enters a ModerationQueue.
|
||||
@@ -5353,6 +5363,11 @@ type Subscription {
|
||||
"""
|
||||
commentCreated(storyID: ID!): CommentCreatedPayload!
|
||||
|
||||
"""
|
||||
commentReleased returns when a Comment on a premoderated stream is approved
|
||||
"""
|
||||
commentReleased(storyID: ID!): CommentReleasedPayload!
|
||||
|
||||
"""
|
||||
commentReplyCreated returns when a Comment is posted in the ancestor chain of
|
||||
comments.
|
||||
|
||||
Reference in New Issue
Block a user