useIsSentryEmployee.ts 650 B

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