mirror of
https://github.com/wassname/talk.git
synced 2026-09-09 11:38:08 +08:00
[CORL-1180] Moderation + Editing Improvements (#3020)
* fix: handle moderating edited comments better * fix: add back deleted audit trail entry Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
kodiakhq[bot]
parent
4f5c0e285c
commit
5b589bfe2b
@@ -47,7 +47,7 @@ const ApproveCommentMutation = createMutation(
|
||||
}
|
||||
}
|
||||
}
|
||||
...ModeratedByContainer_comment
|
||||
...ModerateCardContainer_comment
|
||||
}
|
||||
moderationQueues(
|
||||
storyID: $storyID
|
||||
@@ -83,7 +83,22 @@ const ApproveCommentMutation = createMutation(
|
||||
proxy.setValue("APPROVED", "status");
|
||||
proxy.setValue(true, "viewerDidModerate");
|
||||
},
|
||||
updater: (store) => {
|
||||
updater: (store, data) => {
|
||||
// If no comment came back or the returned comment status was the same,
|
||||
// don't remove it from the connections!
|
||||
if (
|
||||
!data.approveComment ||
|
||||
!data.approveComment.comment ||
|
||||
data.approveComment.comment.status !== "APPROVED"
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Ensure that the comment retains the viewerDidModerate state after it
|
||||
// comes back from the update.
|
||||
const proxy = store.get(input.commentID)!;
|
||||
proxy.setValue(true, "viewerDidModerate");
|
||||
|
||||
const connections = [
|
||||
getQueueConnection(
|
||||
store,
|
||||
|
||||
@@ -47,7 +47,7 @@ const RejectCommentMutation = createMutation(
|
||||
}
|
||||
}
|
||||
}
|
||||
...ModeratedByContainer_comment
|
||||
...ModerateCardContainer_comment
|
||||
}
|
||||
moderationQueues(
|
||||
storyID: $storyID
|
||||
@@ -83,7 +83,22 @@ const RejectCommentMutation = createMutation(
|
||||
proxy.setValue("REJECTED", "status");
|
||||
proxy.setValue(true, "viewerDidModerate");
|
||||
},
|
||||
updater: (store) => {
|
||||
updater: (store, data) => {
|
||||
// If no comment came back or the returned comment status was the same,
|
||||
// don't remove it from the connections!
|
||||
if (
|
||||
!data.rejectComment ||
|
||||
!data.rejectComment.comment ||
|
||||
data.rejectComment.comment.status !== "REJECTED"
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Ensure that the comment retains the viewerDidModerate state after it
|
||||
// comes back from the update.
|
||||
const proxy = store.get(input.commentID)!;
|
||||
proxy.setValue(true, "viewerDidModerate");
|
||||
|
||||
const connections = [
|
||||
getQueueConnection(store, "REPORTED", input.storyID),
|
||||
getQueueConnection(store, "PENDING", input.storyID),
|
||||
|
||||
@@ -375,7 +375,7 @@ it("approves comment in reported queue", async () => {
|
||||
});
|
||||
return {
|
||||
comment: {
|
||||
id: reportedComments[0].id,
|
||||
...reportedComments[0],
|
||||
status: GQLCOMMENT_STATUS.APPROVED,
|
||||
statusHistory: {
|
||||
edges: [
|
||||
@@ -473,7 +473,7 @@ it("rejects comment in reported queue", async () => {
|
||||
});
|
||||
return {
|
||||
comment: {
|
||||
id: reportedComments[0].id,
|
||||
...reportedComments[0],
|
||||
status: GQLCOMMENT_STATUS.REJECTED,
|
||||
statusHistory: {
|
||||
edges: [
|
||||
|
||||
@@ -245,7 +245,7 @@ it("approves comment in rejected queue", async () => {
|
||||
});
|
||||
return {
|
||||
comment: {
|
||||
id: rejectedComments[0].id,
|
||||
...rejectedComments[0],
|
||||
status: GQLCOMMENT_STATUS.APPROVED,
|
||||
statusHistory: {
|
||||
edges: [
|
||||
|
||||
@@ -95,7 +95,7 @@ it("approves single comment", async () => {
|
||||
});
|
||||
return {
|
||||
comment: {
|
||||
id: comment.id,
|
||||
...comment,
|
||||
status: GQLCOMMENT_STATUS.APPROVED,
|
||||
statusHistory: {
|
||||
edges: [
|
||||
@@ -148,9 +148,8 @@ it("rejects single comment", async () => {
|
||||
});
|
||||
return {
|
||||
comment: {
|
||||
id: comment.id,
|
||||
...comment,
|
||||
status: GQLCOMMENT_STATUS.REJECTED,
|
||||
author: comment.author,
|
||||
statusHistory: {
|
||||
edges: [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user