View the status of a specific comment edit property

View the status of a specific comment edit property in Bitsocial React Hooks. Usage, options, and examples.

const comment = useComment({ commentCid });
const editedComment = useEditedComment({ comment });
if (editedComment.failedEdits.removed !== undefined) {
  console.log("failed editing comment.removed property");
}
if (editedComment.succeededEdits.removed !== undefined) {
  console.log("succeeded editing comment.removed property");
}
if (editedCommentResult.pendingEdits.removed !== undefined) {
  console.log("pending editing comment.removed property");
}

// view the full comment with all edited properties (both succeeded and pending)
console.log(editedComment.editedComment);
console.log(editedComment.editedComment.commentModeration?.removed);

// view the state of all edits of the comment
console.log(editedComment.state); // 'unedited' | 'succeeded' | 'pending' | 'failed'

Moderation fields are mirrored on both the top-level keys like comment.removed and the nested comment.commentModeration.removed shape.

A pending or succeeded ban, commentModeration.author.banExpiresAt, shows on the edited comment as the author’s ban, author.community.banExpiresAt, and as the mark pkc-js 0.0.158+ puts on the comment a ban was published on, authorBanExpiresAt. A ban of 0 removes that comment’s authorBanExpiresAt and leaves the author’s ban as it is.