From 6c8b127ff9893188f8bffa9762d8b88ad4b4b134 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Sat, 21 May 2022 13:34:52 +0100 Subject: [PATCH] chore: isHosted -> isCloudHosted for clarity --- app/components/ErrorBoundary.tsx | 4 ++-- app/components/Sidebar/Settings.tsx | 4 ++-- app/hooks/useAuthorizedSettingsConfig.ts | 6 +++--- app/scenes/Login/index.tsx | 8 ++++---- app/scenes/Settings/Details.tsx | 4 ++-- app/scenes/Settings/Notifications.tsx | 6 +++--- app/scenes/Settings/Security.tsx | 4 ++-- app/utils/ApiClient.ts | 4 ++-- app/utils/isCloudHosted.ts | 8 ++++++++ app/utils/isHosted.ts | 5 ----- 10 files changed, 28 insertions(+), 25 deletions(-) create mode 100644 app/utils/isCloudHosted.ts delete mode 100644 app/utils/isHosted.ts diff --git a/app/components/ErrorBoundary.tsx b/app/components/ErrorBoundary.tsx index 6445c4fa9..f8de23288 100644 --- a/app/components/ErrorBoundary.tsx +++ b/app/components/ErrorBoundary.tsx @@ -9,7 +9,7 @@ import CenteredContent from "~/components/CenteredContent"; import PageTitle from "~/components/PageTitle"; import Text from "~/components/Text"; import env from "~/env"; -import isHosted from "~/utils/isHosted"; +import isCloudHosted from "~/utils/isCloudHosted"; import Logger from "~/utils/logger"; type Props = WithTranslation & { @@ -59,7 +59,7 @@ class ErrorBoundary extends React.Component { if (this.error) { const error = this.error; - const isReported = !!env.SENTRY_DSN && isHosted; + const isReported = !!env.SENTRY_DSN && isCloudHosted; const isChunkError = this.error.message.match(/chunk/); if (isChunkError) { diff --git a/app/components/Sidebar/Settings.tsx b/app/components/Sidebar/Settings.tsx index 83f0ad942..647c6d6a9 100644 --- a/app/components/Sidebar/Settings.tsx +++ b/app/components/Sidebar/Settings.tsx @@ -8,7 +8,7 @@ import styled from "styled-components"; import Flex from "~/components/Flex"; import Scrollable from "~/components/Scrollable"; import useAuthorizedSettingsConfig from "~/hooks/useAuthorizedSettingsConfig"; -import isHosted from "~/utils/isHosted"; +import isCloudHosted from "~/utils/isCloudHosted"; import Sidebar from "./Sidebar"; import Header from "./components/Header"; import Section from "./components/Section"; @@ -51,7 +51,7 @@ function SettingsSidebar() { ))} - {!isHosted && ( + {!isCloudHosted && (
diff --git a/app/hooks/useAuthorizedSettingsConfig.ts b/app/hooks/useAuthorizedSettingsConfig.ts index 0ccad4c6e..f70def539 100644 --- a/app/hooks/useAuthorizedSettingsConfig.ts +++ b/app/hooks/useAuthorizedSettingsConfig.ts @@ -29,7 +29,7 @@ import Zapier from "~/scenes/Settings/Zapier"; import SlackIcon from "~/components/SlackIcon"; import ZapierIcon from "~/components/ZapierIcon"; import env from "~/env"; -import isHosted from "~/utils/isHosted"; +import isCloudHosted from "~/utils/isCloudHosted"; import useCurrentTeam from "./useCurrentTeam"; import usePolicy from "./usePolicy"; @@ -163,7 +163,7 @@ const useAuthorizedSettingsConfig = () => { name: "Slack", path: "/settings/integrations/slack", component: Slack, - enabled: can.update && (!!env.SLACK_CLIENT_ID || isHosted), + enabled: can.update && (!!env.SLACK_CLIENT_ID || isCloudHosted), group: t("Integrations"), icon: SlackIcon, }, @@ -171,7 +171,7 @@ const useAuthorizedSettingsConfig = () => { name: "Zapier", path: "/settings/integrations/zapier", component: Zapier, - enabled: can.update && isHosted, + enabled: can.update && isCloudHosted, group: t("Integrations"), icon: ZapierIcon, }, diff --git a/app/scenes/Login/index.tsx b/app/scenes/Login/index.tsx index 6ddf04f45..4b0ad47c3 100644 --- a/app/scenes/Login/index.tsx +++ b/app/scenes/Login/index.tsx @@ -21,7 +21,7 @@ import env from "~/env"; import useQuery from "~/hooks/useQuery"; import useStores from "~/hooks/useStores"; import { isCustomDomain } from "~/utils/domains"; -import isHosted from "~/utils/isHosted"; +import isCloudHosted from "~/utils/isCloudHosted"; import { changeLanguage, detectLanguage } from "~/utils/language"; import AuthenticationProvider from "./AuthenticationProvider"; import Notices from "./Notices"; @@ -30,7 +30,7 @@ function Header({ config }: { config?: Config | undefined }) { const { t } = useTranslation(); const isSubdomain = !!config?.hostname; - if (!isHosted || isCustomDomain()) { + if (!isCloudHosted || isCustomDomain()) { return null; } @@ -103,7 +103,7 @@ function Login() { {t("Failed to load configuration.")} - {!isHosted && ( + {!isCloudHosted && (

{t( "Check the network requests and server logs for full details of the error." @@ -158,7 +158,7 @@ function Login() { - {env.TEAM_LOGO && !isHosted ? ( + {env.TEAM_LOGO && !isCloudHosted ? ( ) : ( diff --git a/app/scenes/Settings/Details.tsx b/app/scenes/Settings/Details.tsx index 3ee27a3e5..e763b083f 100644 --- a/app/scenes/Settings/Details.tsx +++ b/app/scenes/Settings/Details.tsx @@ -13,7 +13,7 @@ import env from "~/env"; import useCurrentTeam from "~/hooks/useCurrentTeam"; import useStores from "~/hooks/useStores"; import useToasts from "~/hooks/useToasts"; -import isHosted from "~/utils/isHosted"; +import isCloudHosted from "~/utils/isCloudHosted"; import ImageInput from "./components/ImageInput"; import SettingRow from "./components/SettingRow"; @@ -134,7 +134,7 @@ function Details() { /> - {isHosted && ( + {isCloudHosted && (