Share Permissions (#761)

* Share restrictions

* Tweak language, add spec
This commit is contained in:
Tom Moor
2018-08-19 16:06:39 -07:00
committed by GitHub
parent e704a86e36
commit 328f731541
21 changed files with 224 additions and 185 deletions

View File

@@ -2,11 +2,12 @@
import * as React from 'react';
import { throttle } from 'lodash';
import { observable } from 'mobx';
import { observer } from 'mobx-react';
import { observer, inject } from 'mobx-react';
import styled from 'styled-components';
import breakpoint from 'styled-components-breakpoint';
import { NewDocumentIcon } from 'outline-icons';
import Document from 'models/Document';
import AuthStore from 'stores/AuthStore';
import { documentEditUrl } from 'utils/routeHelpers';
import Flex from 'shared/components/Flex';
@@ -32,6 +33,7 @@ type Props = {
autosave?: boolean,
}) => *,
history: Object,
auth: AuthStore,
};
@observer
@@ -90,7 +92,9 @@ class Header extends React.Component<Props> {
isPublishing,
isSaving,
savingIsDisabled,
auth,
} = this.props;
const canShareDocuments = auth.team && auth.team.sharing;
return (
<Actions
@@ -134,7 +138,8 @@ class Header extends React.Component<Props> {
</Action>
)}
{!isDraft &&
!isEditing && (
!isEditing &&
canShareDocuments && (
<Action>
<Link onClick={this.handleShareLink} title="Share document">
Share
@@ -251,4 +256,4 @@ const Link = styled.a`
cursor: ${props => (props.disabled ? 'default' : 'pointer')};
`;
export default Header;
export default inject('auth')(Header);