Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

595 B
Raw Blame
import type { OrganizationNotificationLockApi } from '~/generated/core/api.schemas'

export const LOCKED_BY_ORGANIZATION = 'An admin of your organization set this for you'

/** Looks up the value an organization enforces for a setting, or null when the choice is the member's. */
export function lockedValueFor(
    locks: OrganizationNotificationLockApi[] | undefined,
    setting: string,
    scopeId: string | number = ''
): boolean | null {
    const match = locks?.find((lock) => lock.setting === setting && lock.scope_id === String(scopeId))
    return match ? match.locked_value : null
}