Skip to content

Commit

Permalink
Merge pull request #4334 from coralproject/bug/CORL-2891-edit-child-a…
Browse files Browse the repository at this point in the history
…fter-parent-edited

[CORL-2891]: fix edit child reply to edited parent not updating
  • Loading branch information
tessalt authored Sep 26, 2023
2 parents f059296 + 65764ee commit 2fac0a8
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
2 changes: 1 addition & 1 deletion server/src/core/server/stacks/editComment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export default async function edit(
throw new CommentNotFoundError(input.id);
}

// If the original comment was a reply, then get it's parent!
// If the original comment was a reply, then get its parent!
const { parentID, parentRevisionID, siteID } = originalStaleComment;
const parent = await retrieveParent(mongo, tenant.id, {
parentID,
Expand Down
8 changes: 0 additions & 8 deletions server/src/core/server/stacks/helpers/retrieveParent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
ParentCommentRejectedError,
} from "coral-server/errors";
import {
getLatestRevision,
hasPublishedStatus,
retrieveComment,
} from "coral-server/models/comment";
Expand All @@ -31,13 +30,6 @@ async function retrieveParent(
throw new CommentNotFoundError(input.parentID);
}

// Check to see that the most recent revision matches the one we just replied
// to.
const revision = getLatestRevision(parent);
if (revision.id !== input.parentRevisionID) {
throw new CommentRevisionNotFoundError(parent.id, input.parentRevisionID);
}

// Check that the parent comment was visible.
if (!hasPublishedStatus(parent)) {
if (parent.status === GQLCOMMENT_STATUS.REJECTED) {
Expand Down

0 comments on commit 2fac0a8

Please sign in to comment.