From 4f34b69cfa8bc1e491bd0551cbae554f541c2c1a Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Thu, 14 Oct 2021 21:49:35 -0700 Subject: [PATCH] Display notice instead of hide when Slack integration unavailable --- app/routes/settings.js | 4 +- app/scenes/Settings/Slack.js | 142 +++++++++++++++++++---------------- 2 files changed, 80 insertions(+), 66 deletions(-) diff --git a/app/routes/settings.js b/app/routes/settings.js index b03a8bf0..967c98b8 100644 --- a/app/routes/settings.js +++ b/app/routes/settings.js @@ -30,9 +30,7 @@ export default function SettingsRoutes() { - {env.SLACK_KEY && ( - - )} + {isHosted && ( )} diff --git a/app/scenes/Settings/Slack.js b/app/scenes/Settings/Slack.js index 24b7b319..bc0941b0 100644 --- a/app/scenes/Settings/Slack.js +++ b/app/scenes/Settings/Slack.js @@ -39,6 +39,7 @@ function Slack() { return ( }> Slack + {error === "access_denied" && ( @@ -62,72 +63,87 @@ function Slack() { components={{ em: }} /> -

- {commandIntegration ? ( - - ) : ( - - )} -

-

 

- -

{t("Collections")}

- - - Connect Outline collections to Slack channels and messages will be - automatically posted to Slack when documents are published or updated. - - - - - {collections.orderedData.map((collection) => { - const integration = find(integrations.slackIntegrations, { - collectionId: collection.id, - }); - - if (integration) { - return ( - } - subtitle={ - {{ channelName }} channel`} - values={{ channelName: integration.settings.channel }} - components={{ em: }} - /> - } - actions={ - - } + {env.SLACK_KEY ? ( + <> +

+ {commandIntegration ? ( + + ) : ( + - ); - } + )} +

+

 

- return ( - } - actions={ - +

{t("Collections")}

+ + + Connect Outline collections to Slack channels and messages will be + automatically posted to Slack when documents are published or + updated. + + + + + {collections.orderedData.map((collection) => { + const integration = find(integrations.slackIntegrations, { + collectionId: collection.id, + }); + + if (integration) { + return ( + } + subtitle={ + {{ channelName }} channel`} + values={{ channelName: integration.settings.channel }} + components={{ em: }} + /> + } + actions={ + + } + /> + ); } - /> - ); - })} - + + return ( + } + actions={ + + } + /> + ); + })} +
+ + ) : ( + + + The Slack integration is currently disabled. Please set the + associated environment variables and restart the server to enable + the integration. + + + )}
); }