Devendra174's picture
Upload folder using huggingface_hub
1e92f2d verified
import { getPostCommentsTree } from 'calypso/state/comments/selectors/get-post-comments-tree';
import 'calypso/state/comments/init';
/**
* Returns the parent comment of a given comment
* @param {Object} state Redux state
* @param {number} siteId Site identifier
* @param {number} postId Post identifier
* @param {number} commentId Comment identifier
* @returns {Object} The parent comment
*/
export const getParentComment = ( state, siteId, postId, commentId ) => {
const commentsTree = getPostCommentsTree( state, siteId, postId, 'all' );
const parentCommentId = commentsTree[ commentId ]?.data.parent?.ID ?? 0;
return commentsTree[ parentCommentId ]?.data ?? {};
};