"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.canCreateReplyV2 = canCreateReplyV2;
const channel_permission_1 = require("../channel-permission");
const portal_privilege_1 = require("../portal-privilege");
/**
 * Utility to determine if User has privileges to create a reply in a channel
 * @param channel
 * @param user
 * @returns {boolean}
 */
function canCreateReplyV2(channel, user = {}) {
    if ((0, portal_privilege_1.hasOrgAdminUpdateRights)(user, channel.orgId)) {
        return true;
    }
    if (!channel.allowReply) {
        return false;
    }
    const channelPermission = new channel_permission_1.ChannelPermission(channel);
    return channelPermission.canPostToChannel(user);
}
//# sourceMappingURL=can-create-reply-v2.js.map