This repository has been archived on 2022-08-14. You can view files and clone it, but cannot push or open issues or pull requests.
outline/app/scenes/Settings/Shares.js
Tom Moor 328f731541
Share Permissions (#761)
* Share restrictions

* Tweak language, add spec
2018-08-19 16:06:39 -07:00

60 lines
1.7 KiB
JavaScript

// @flow
import * as React from 'react';
import { observer, inject } from 'mobx-react';
import { Link } from 'react-router-dom';
import SharesStore from 'stores/SharesStore';
import AuthStore from 'stores/AuthStore';
import ShareListItem from './components/ShareListItem';
import List from 'components/List';
import CenteredContent from 'components/CenteredContent';
import PageTitle from 'components/PageTitle';
import HelpText from 'components/HelpText';
type Props = {
shares: SharesStore,
auth: AuthStore,
};
@observer
class Shares extends React.Component<Props> {
componentDidMount() {
this.props.shares.fetchPage({ limit: 100 });
}
render() {
const { shares, auth } = this.props;
const { user } = auth;
const canShareDocuments = auth.team && auth.team.sharing;
return (
<CenteredContent>
<PageTitle title="Share Links" />
<h1>Share Links</h1>
<HelpText>
Documents that have been shared appear below. Anyone that has the link
can access a read-only version of the document until the link has been
revoked.
</HelpText>
{user &&
user.isAdmin && (
<HelpText>
{!canShareDocuments && (
<strong>Sharing is currently disabled.</strong>
)}{' '}
You can turn {canShareDocuments ? 'off' : 'on'} public document
sharing in <Link to="/settings/security">security settings</Link>.
</HelpText>
)}
<List>
{shares.orderedData.map(share => (
<ShareListItem key={share.id} share={share} />
))}
</List>
</CenteredContent>
);
}
}
export default inject('shares', 'auth')(Shares);