mirror of
https://github.com/outline/outline.git
synced 2026-06-13 11:25:03 +03:00
chore: Disable public document subscription when SMTP is not configured (#11938)
This commit is contained in:
@@ -207,31 +207,33 @@ function InnerPublicAccess(
|
||||
/>
|
||||
}
|
||||
/>
|
||||
<ListItem
|
||||
title={
|
||||
<Text type="tertiary" as={Flex}>
|
||||
{t("Email subscriptions")}
|
||||
<Tooltip
|
||||
content={t(
|
||||
"Allow viewers to subscribe and receive email notifications when documents are updated"
|
||||
)}
|
||||
>
|
||||
<NudeButton size={18}>
|
||||
<QuestionMarkIcon size={18} />
|
||||
</NudeButton>
|
||||
</Tooltip>
|
||||
</Text>
|
||||
}
|
||||
actions={
|
||||
<Switch
|
||||
aria-label={t("Email subscriptions")}
|
||||
checked={share?.allowSubscriptions ?? true}
|
||||
onChange={handleSubscriptionsChanged}
|
||||
width={26}
|
||||
height={14}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
{env.EMAIL_ENABLED && (
|
||||
<ListItem
|
||||
title={
|
||||
<Text type="tertiary" as={Flex}>
|
||||
{t("Email subscriptions")}
|
||||
<Tooltip
|
||||
content={t(
|
||||
"Allow viewers to subscribe and receive email notifications when documents are updated"
|
||||
)}
|
||||
>
|
||||
<NudeButton size={18}>
|
||||
<QuestionMarkIcon size={18} />
|
||||
</NudeButton>
|
||||
</Tooltip>
|
||||
</Text>
|
||||
}
|
||||
actions={
|
||||
<Switch
|
||||
aria-label={t("Email subscriptions")}
|
||||
checked={share?.allowSubscriptions ?? true}
|
||||
onChange={handleSubscriptionsChanged}
|
||||
width={26}
|
||||
height={14}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
)}
|
||||
<ListItem
|
||||
title={
|
||||
<Text type="tertiary" as={Flex}>
|
||||
|
||||
@@ -251,31 +251,33 @@ function PublicAccess(
|
||||
/>
|
||||
}
|
||||
/>
|
||||
<ListItem
|
||||
title={
|
||||
<Text type="tertiary" as={Flex}>
|
||||
{t("Email subscriptions")}
|
||||
<Tooltip
|
||||
content={t(
|
||||
"Allow viewers to subscribe and receive email notifications when this document is updated"
|
||||
)}
|
||||
>
|
||||
<NudeButton size={18}>
|
||||
<QuestionMarkIcon size={18} />
|
||||
</NudeButton>
|
||||
</Tooltip>
|
||||
</Text>
|
||||
}
|
||||
actions={
|
||||
<Switch
|
||||
aria-label={t("Email subscriptions")}
|
||||
checked={share?.allowSubscriptions ?? true}
|
||||
onChange={handleSubscriptionsChanged}
|
||||
width={26}
|
||||
height={14}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
{env.EMAIL_ENABLED && (
|
||||
<ListItem
|
||||
title={
|
||||
<Text type="tertiary" as={Flex}>
|
||||
{t("Email subscriptions")}
|
||||
<Tooltip
|
||||
content={t(
|
||||
"Allow viewers to subscribe and receive email notifications when this document is updated"
|
||||
)}
|
||||
>
|
||||
<NudeButton size={18}>
|
||||
<QuestionMarkIcon size={18} />
|
||||
</NudeButton>
|
||||
</Tooltip>
|
||||
</Text>
|
||||
}
|
||||
actions={
|
||||
<Switch
|
||||
aria-label={t("Email subscriptions")}
|
||||
checked={share?.allowSubscriptions ?? true}
|
||||
onChange={handleSubscriptionsChanged}
|
||||
width={26}
|
||||
height={14}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
)}
|
||||
<ListItem
|
||||
title={
|
||||
<Text type="tertiary" as={Flex}>
|
||||
|
||||
@@ -34,6 +34,7 @@ import DocumentMenu from "~/menus/DocumentMenu";
|
||||
import NewChildDocumentMenu from "~/menus/NewChildDocumentMenu";
|
||||
import TableOfContentsMenu from "~/menus/TableOfContentsMenu";
|
||||
import TemplatesMenu from "~/menus/TemplatesMenu";
|
||||
import env from "~/env";
|
||||
import { documentEditPath } from "~/utils/routeHelpers";
|
||||
import ObservingBanner from "./ObservingBanner";
|
||||
import PublicBreadcrumb from "./PublicBreadcrumb";
|
||||
@@ -213,7 +214,7 @@ function DocumentHeader({
|
||||
}
|
||||
actions={
|
||||
<>
|
||||
{allowSubscriptions !== false && !user && (
|
||||
{allowSubscriptions !== false && !user && env.EMAIL_ENABLED && (
|
||||
<SubscribeAction shareId={shareId} documentId={document.id} />
|
||||
)}
|
||||
<AppearanceAction />
|
||||
|
||||
@@ -441,6 +441,10 @@ router.post(
|
||||
validate(T.SharesSubscribeSchema),
|
||||
transaction(),
|
||||
async (ctx: APIContext<T.SharesSubscribeReq>) => {
|
||||
if (!env.EMAIL_ENABLED) {
|
||||
throw InvalidRequestError("Email is not configured");
|
||||
}
|
||||
|
||||
const { shareId, documentId, email } = ctx.input.body;
|
||||
const { transaction } = ctx.state;
|
||||
const team = await getTeamFromContext(ctx, { includeStateCookie: false });
|
||||
|
||||
Reference in New Issue
Block a user