File tree Expand file tree Collapse file tree 4 files changed +60
-51
lines changed
scenes/Document/components Expand file tree Collapse file tree 4 files changed +60
-51
lines changed Original file line number Diff line number Diff line change @@ -207,31 +207,33 @@ function InnerPublicAccess(
207207 />
208208 }
209209 />
210- < ListItem
211- title = {
212- < Text type = "tertiary" as = { Flex } >
213- { t ( "Email subscriptions" ) }
214- < Tooltip
215- content = { t (
216- "Allow viewers to subscribe and receive email notifications when documents are updated"
217- ) }
218- >
219- < NudeButton size = { 18 } >
220- < QuestionMarkIcon size = { 18 } />
221- </ NudeButton >
222- </ Tooltip >
223- </ Text >
224- }
225- actions = {
226- < Switch
227- aria-label = { t ( "Email subscriptions" ) }
228- checked = { share ?. allowSubscriptions ?? true }
229- onChange = { handleSubscriptionsChanged }
230- width = { 26 }
231- height = { 14 }
232- />
233- }
234- />
210+ { env . EMAIL_ENABLED && (
211+ < ListItem
212+ title = {
213+ < Text type = "tertiary" as = { Flex } >
214+ { t ( "Email subscriptions" ) }
215+ < Tooltip
216+ content = { t (
217+ "Allow viewers to subscribe and receive email notifications when documents are updated"
218+ ) }
219+ >
220+ < NudeButton size = { 18 } >
221+ < QuestionMarkIcon size = { 18 } />
222+ </ NudeButton >
223+ </ Tooltip >
224+ </ Text >
225+ }
226+ actions = {
227+ < Switch
228+ aria-label = { t ( "Email subscriptions" ) }
229+ checked = { share ?. allowSubscriptions ?? true }
230+ onChange = { handleSubscriptionsChanged }
231+ width = { 26 }
232+ height = { 14 }
233+ />
234+ }
235+ />
236+ ) }
235237 < ListItem
236238 title = {
237239 < Text type = "tertiary" as = { Flex } >
Original file line number Diff line number Diff line change @@ -251,31 +251,33 @@ function PublicAccess(
251251 />
252252 }
253253 />
254- < ListItem
255- title = {
256- < Text type = "tertiary" as = { Flex } >
257- { t ( "Email subscriptions" ) }
258- < Tooltip
259- content = { t (
260- "Allow viewers to subscribe and receive email notifications when this document is updated"
261- ) }
262- >
263- < NudeButton size = { 18 } >
264- < QuestionMarkIcon size = { 18 } />
265- </ NudeButton >
266- </ Tooltip >
267- </ Text >
268- }
269- actions = {
270- < Switch
271- aria-label = { t ( "Email subscriptions" ) }
272- checked = { share ?. allowSubscriptions ?? true }
273- onChange = { handleSubscriptionsChanged }
274- width = { 26 }
275- height = { 14 }
276- />
277- }
278- />
254+ { env . EMAIL_ENABLED && (
255+ < ListItem
256+ title = {
257+ < Text type = "tertiary" as = { Flex } >
258+ { t ( "Email subscriptions" ) }
259+ < Tooltip
260+ content = { t (
261+ "Allow viewers to subscribe and receive email notifications when this document is updated"
262+ ) }
263+ >
264+ < NudeButton size = { 18 } >
265+ < QuestionMarkIcon size = { 18 } />
266+ </ NudeButton >
267+ </ Tooltip >
268+ </ Text >
269+ }
270+ actions = {
271+ < Switch
272+ aria-label = { t ( "Email subscriptions" ) }
273+ checked = { share ?. allowSubscriptions ?? true }
274+ onChange = { handleSubscriptionsChanged }
275+ width = { 26 }
276+ height = { 14 }
277+ />
278+ }
279+ />
280+ ) }
279281 < ListItem
280282 title = {
281283 < Text type = "tertiary" as = { Flex } >
Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ import DocumentMenu from "~/menus/DocumentMenu";
3434import NewChildDocumentMenu from "~/menus/NewChildDocumentMenu" ;
3535import TableOfContentsMenu from "~/menus/TableOfContentsMenu" ;
3636import TemplatesMenu from "~/menus/TemplatesMenu" ;
37+ import env from "~/env" ;
3738import { documentEditPath } from "~/utils/routeHelpers" ;
3839import ObservingBanner from "./ObservingBanner" ;
3940import PublicBreadcrumb from "./PublicBreadcrumb" ;
@@ -213,7 +214,7 @@ function DocumentHeader({
213214 }
214215 actions = {
215216 < >
216- { allowSubscriptions !== false && ! user && (
217+ { allowSubscriptions !== false && ! user && env . EMAIL_ENABLED && (
217218 < SubscribeAction shareId = { shareId } documentId = { document . id } />
218219 ) }
219220 < AppearanceAction />
Original file line number Diff line number Diff line change @@ -441,6 +441,10 @@ router.post(
441441 validate ( T . SharesSubscribeSchema ) ,
442442 transaction ( ) ,
443443 async ( ctx : APIContext < T . SharesSubscribeReq > ) => {
444+ if ( ! env . EMAIL_ENABLED ) {
445+ throw InvalidRequestError ( "Email is not configured" ) ;
446+ }
447+
444448 const { shareId, documentId, email } = ctx . input . body ;
445449 const { transaction } = ctx . state ;
446450 const team = await getTeamFromContext ( ctx , { includeStateCookie : false } ) ;
You can’t perform that action at this time.
0 commit comments