// @flow import { find } from "lodash"; import { inject, observer } from "mobx-react"; import * as React from "react"; import styled from "styled-components"; import getQueryVariable from "shared/utils/getQueryVariable"; import AuthStore from "stores/AuthStore"; import CollectionsStore from "stores/CollectionsStore"; import IntegrationsStore from "stores/IntegrationsStore"; import Button from "components/Button"; import CenteredContent from "components/CenteredContent"; import HelpText from "components/HelpText"; import Notice from "components/Notice"; import PageTitle from "components/PageTitle"; import SlackButton from "./components/SlackButton"; import env from "env"; type Props = { collections: CollectionsStore, integrations: IntegrationsStore, auth: AuthStore, }; @observer class Slack extends React.Component { error: ?string; componentDidMount() { this.error = getQueryVariable("error"); this.props.collections.fetchPage({ limit: 100 }); this.props.integrations.fetchPage(); } get commandIntegration() { return find(this.props.integrations.slackIntegrations, { type: "command", }); } render() { const { collections, integrations, auth } = this.props; const teamId = auth.team ? auth.team.id : ""; return (

Slack

{this.error === "access_denied" && ( Whoops, you need to accept the permissions in Slack to connect Outline to your team. Try again? )} {this.error === "unauthenticated" && ( Something went wrong while authenticating your request. Please try logging in again? )} Preview Outline links your team mates share and use the{" "} /outline slash command in Slack to search for documents in your team’s wiki.

{this.commandIntegration ? ( ) : ( )}

 

Collections

Connect Outline collections to Slack channels and messages will be posted in Slack when documents are published or updated. {collections.orderedData.map((collection) => { const integration = find(integrations.slackIntegrations, { collectionId: collection.id, }); if (integration) { return ( {collection.name} posting activity to the{" "} {integration.settings.channel} Slack channel ); } return ( {collection.name} ); })}
); } } const List = styled.ol` list-style: none; margin: 8px 0; padding: 0; `; const ListItem = styled.li` display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid #eaebea; `; const Code = styled.code` padding: 4px 6px; margin: 0 2px; background: ${(props) => props.theme.codeBackground}; border-radius: 4px; `; export default inject("collections", "integrations", "auth")(Slack);