fix: Hide notification settings when SMTP_ configuration is unset
This commit is contained in:
@@ -12,6 +12,7 @@ import Notice from "components/Notice";
|
||||
import Scene from "components/Scene";
|
||||
import Subheading from "components/Subheading";
|
||||
import NotificationListItem from "./components/NotificationListItem";
|
||||
import env from "env";
|
||||
import useCurrentUser from "hooks/useCurrentUser";
|
||||
import useStores from "hooks/useStores";
|
||||
import useToasts from "hooks/useToasts";
|
||||
@@ -90,6 +91,8 @@ function Notifications() {
|
||||
|
||||
return (
|
||||
<Scene title={t("Notifications")} icon={<EmailIcon color="currentColor" />}>
|
||||
<Heading>{t("Notifications")}</Heading>
|
||||
|
||||
{showSuccessNotice && (
|
||||
<Notice>
|
||||
<Trans>
|
||||
@@ -97,40 +100,55 @@ function Notifications() {
|
||||
</Trans>
|
||||
</Notice>
|
||||
)}
|
||||
<Heading>{t("Notifications")}</Heading>
|
||||
<HelpText>
|
||||
<Trans>
|
||||
Manage when and where you receive email notifications from Outline.
|
||||
Your email address can be updated in your SSO provider.
|
||||
</Trans>
|
||||
</HelpText>
|
||||
<Input
|
||||
type="email"
|
||||
value={user.email}
|
||||
label={t("Email address")}
|
||||
readOnly
|
||||
short
|
||||
/>
|
||||
|
||||
<Subheading>{t("Notifications")}</Subheading>
|
||||
|
||||
{options.map((option, index) => {
|
||||
if (option.separator) return <Separator key={`separator-${index}`} />;
|
||||
|
||||
const setting = notificationSettings.getByEvent(option.event);
|
||||
|
||||
return (
|
||||
<NotificationListItem
|
||||
key={option.event}
|
||||
onChange={handleChange}
|
||||
setting={setting}
|
||||
disabled={
|
||||
(setting && setting.isSaving) || notificationSettings.isFetching
|
||||
}
|
||||
{...option}
|
||||
{env.NOTIFICATIONS_ENABLED ? (
|
||||
<>
|
||||
<Input
|
||||
type="email"
|
||||
value={user.email}
|
||||
label={t("Email address")}
|
||||
readOnly
|
||||
short
|
||||
/>
|
||||
);
|
||||
})}
|
||||
|
||||
<Subheading>{t("Notifications")}</Subheading>
|
||||
|
||||
{options.map((option, index) => {
|
||||
if (option.separator) {
|
||||
return <Separator key={`separator-${index}`} />;
|
||||
}
|
||||
|
||||
const setting = notificationSettings.getByEvent(option.event);
|
||||
|
||||
return (
|
||||
<NotificationListItem
|
||||
key={option.event}
|
||||
onChange={handleChange}
|
||||
setting={setting}
|
||||
disabled={
|
||||
(setting && setting.isSaving) ||
|
||||
notificationSettings.isFetching
|
||||
}
|
||||
{...option}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</>
|
||||
) : (
|
||||
<Notice>
|
||||
<Trans>
|
||||
The email integration is currently disabled. Please set the
|
||||
associated environment variables and restart the server to enable
|
||||
notifications.
|
||||
</Trans>
|
||||
</Notice>
|
||||
)}
|
||||
</Scene>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@ export default function present(env: Object): Object {
|
||||
SLACK_APP_ID: env.SLACK_APP_ID,
|
||||
MAXIMUM_IMPORT_SIZE: env.MAXIMUM_IMPORT_SIZE || 1024 * 1000 * 5,
|
||||
SUBDOMAINS_ENABLED: env.SUBDOMAINS_ENABLED === "true",
|
||||
NOTIFICATIONS_ENABLED:
|
||||
!!env.SMTP_USERNAME || env.NODE_ENV === "development",
|
||||
GOOGLE_ANALYTICS_ID: env.GOOGLE_ANALYTICS_ID,
|
||||
RELEASE: env.SOURCE_COMMIT || env.SOURCE_VERSION || undefined,
|
||||
};
|
||||
|
||||
@@ -549,6 +549,7 @@
|
||||
"Unsubscription successful. Your notification settings were updated": "Unsubscription successful. Your notification settings were updated",
|
||||
"Manage when and where you receive email notifications from Outline. Your email address can be updated in your SSO provider.": "Manage when and where you receive email notifications from Outline. Your email address can be updated in your SSO provider.",
|
||||
"Email address": "Email address",
|
||||
"The email integration is currently disabled. Please set the associated environment variables and restart the server to enable the integration.": "The email integration is currently disabled. Please set the associated environment variables and restart the server to enable the integration.",
|
||||
"Everyone that has signed into Outline appears here. It’s possible that there are other users who have access through {team.signinMethods} but haven’t signed in yet.": "Everyone that has signed into Outline appears here. It’s possible that there are other users who have access through {team.signinMethods} but haven’t signed in yet.",
|
||||
"Filter": "Filter",
|
||||
"Profile saved": "Profile saved",
|
||||
@@ -578,6 +579,7 @@
|
||||
"Connect Outline collections to Slack channels and messages will be automatically posted to Slack when documents are published or updated.": "Connect Outline collections to Slack channels and messages will be automatically posted to Slack when documents are published or updated.",
|
||||
"Connected to the <em>{{ channelName }}</em> channel": "Connected to the <em>{{ channelName }}</em> channel",
|
||||
"Connect": "Connect",
|
||||
"The Slack integration is currently disabled. Please set the associated environment variables and restart the server to enable the integration.": "The Slack integration is currently disabled. Please set the associated environment variables and restart the server to enable the integration.",
|
||||
"New token": "New token",
|
||||
"You can create an unlimited amount of personal tokens to authenticate\n with the API. Tokens have the same permissions as your user account.\n For more details see the <em>developer documentation</em>.": "You can create an unlimited amount of personal tokens to authenticate\n with the API. Tokens have the same permissions as your user account.\n For more details see the <em>developer documentation</em>.",
|
||||
"Tokens": "Tokens",
|
||||
|
||||
Reference in New Issue
Block a user