Files
sentinel/static/app/utils/useIsSentryEmployee.ts
2024-02-15 17:01:50 +00:00

18 lines
650 B
TypeScript

import {useUser} from 'sentry/utils/useUser';
/**
* Hook to check if the current user is a Sentry employee.
* It uses the user's emails to determine if at least one email is verified
* and ends with the sentry.io domain, which would indicate they are an employee.
*
* @return {boolean} - Returns true if the user is a Sentry employee, otherwise false.
*/
export function useIsSentryEmployee(): boolean {
const {emails} = useUser();
return emails.some(
// TODO: In the near future isStaff should actually mean is a Sentry employee, right now it doesn't.
({email, is_verified}) => email.endsWith('@sentry.io') && is_verified
);
}