import { ChannelPermission } from "../channel-permission";
/**
 * Utility to determine if User has privileges to modify a post
 * @param post
 * @param user
 * @param channel
 * @returns {boolean}
 */
export function canEditPostV2(post, user = {}, channel) {
    const canReplyOrPost = post.parentId ? channel.allowReply : channel.allowPost;
    const channelPermission = new ChannelPermission(channel);
    return (isPostCreator(post, user) &&
        canReplyOrPost &&
        channelPermission.canPostToChannel(user));
}
function isPostCreator(post, user) {
    return !!user.username && post.creator === user.username;
}
//# sourceMappingURL=can-edit-post-v2.js.map