mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-29 11:33:29 -05:00
Read isProjectOwner from EditorContext
GitOrigin-RevId: 57cc4c709d5a9eb5ce1b0b5b5b1ac306b953538d
This commit is contained in:
parent
e26c90f5fc
commit
73a894b666
5 changed files with 5 additions and 13 deletions
|
@ -2,7 +2,6 @@ div(ng-controller="ReactShareProjectModalController")
|
||||||
share-project-modal(
|
share-project-modal(
|
||||||
handle-hide="handleHide"
|
handle-hide="handleHide"
|
||||||
show="show"
|
show="show"
|
||||||
is-project-owner="isProjectOwner"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
div(ng-controller="EditorNavigationToolbarController")
|
div(ng-controller="EditorNavigationToolbarController")
|
||||||
|
|
|
@ -54,7 +54,6 @@ const EditorNavigationToolbarRoot = React.memo(
|
||||||
loading,
|
loading,
|
||||||
isRestrictedTokenMember,
|
isRestrictedTokenMember,
|
||||||
renameProject,
|
renameProject,
|
||||||
isProjectOwner,
|
|
||||||
permissionsLevel,
|
permissionsLevel,
|
||||||
} = useEditorContext(editorContextPropTypes)
|
} = useEditorContext(editorContextPropTypes)
|
||||||
|
|
||||||
|
@ -93,8 +92,8 @@ const EditorNavigationToolbarRoot = React.memo(
|
||||||
}, [view, setView])
|
}, [view, setView])
|
||||||
|
|
||||||
const openShareModal = useCallback(() => {
|
const openShareModal = useCallback(() => {
|
||||||
openShareProjectModal(isProjectOwner)
|
openShareProjectModal()
|
||||||
}, [openShareProjectModal, isProjectOwner])
|
}, [openShareProjectModal])
|
||||||
|
|
||||||
const onShowLeftMenuClick = useCallback(
|
const onShowLeftMenuClick = useCallback(
|
||||||
() => setLeftMenuShown(value => !value),
|
() => setLeftMenuShown(value => !value),
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import { useShareProjectContext } from './share-project-modal'
|
|
||||||
import EditMember from './edit-member'
|
import EditMember from './edit-member'
|
||||||
import LinkSharing from './link-sharing'
|
import LinkSharing from './link-sharing'
|
||||||
import Invite from './invite'
|
import Invite from './invite'
|
||||||
|
@ -6,6 +5,7 @@ import SendInvites from './send-invites'
|
||||||
import ViewMember from './view-member'
|
import ViewMember from './view-member'
|
||||||
import OwnerInfo from './owner-info'
|
import OwnerInfo from './owner-info'
|
||||||
import SendInvitesNotice from './send-invites-notice'
|
import SendInvitesNotice from './send-invites-notice'
|
||||||
|
import { useEditorContext } from '../../../shared/context/editor-context'
|
||||||
import { useProjectContext } from '../../../shared/context/project-context'
|
import { useProjectContext } from '../../../shared/context/project-context'
|
||||||
import { useSplitTestContext } from '../../../shared/context/split-test-context'
|
import { useSplitTestContext } from '../../../shared/context/split-test-context'
|
||||||
import { Row } from 'react-bootstrap'
|
import { Row } from 'react-bootstrap'
|
||||||
|
@ -13,11 +13,11 @@ import PropTypes from 'prop-types'
|
||||||
import RecaptchaConditions from '../../../shared/components/recaptcha-conditions'
|
import RecaptchaConditions from '../../../shared/components/recaptcha-conditions'
|
||||||
|
|
||||||
export default function ShareModalBody() {
|
export default function ShareModalBody() {
|
||||||
const { isProjectOwner } = useShareProjectContext()
|
|
||||||
const { splitTestVariants } = useSplitTestContext({
|
const { splitTestVariants } = useSplitTestContext({
|
||||||
splitTestVariants: PropTypes.object,
|
splitTestVariants: PropTypes.object,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const { isProjectOwner } = useEditorContext()
|
||||||
const { invites, members } = useProjectContext()
|
const { invites, members } = useProjectContext()
|
||||||
|
|
||||||
switch (splitTestVariants['project-share-modal-paywall']) {
|
switch (splitTestVariants['project-share-modal-paywall']) {
|
||||||
|
|
|
@ -18,7 +18,6 @@ const ShareProjectContext = createContext()
|
||||||
|
|
||||||
ShareProjectContext.Provider.propTypes = {
|
ShareProjectContext.Provider.propTypes = {
|
||||||
value: PropTypes.shape({
|
value: PropTypes.shape({
|
||||||
isProjectOwner: PropTypes.bool.isRequired,
|
|
||||||
updateProject: PropTypes.func.isRequired,
|
updateProject: PropTypes.func.isRequired,
|
||||||
monitorRequest: PropTypes.func.isRequired,
|
monitorRequest: PropTypes.func.isRequired,
|
||||||
inFlight: PropTypes.bool,
|
inFlight: PropTypes.bool,
|
||||||
|
@ -44,7 +43,6 @@ const ShareProjectModal = React.memo(function ShareProjectModal({
|
||||||
handleHide,
|
handleHide,
|
||||||
show,
|
show,
|
||||||
animation = true,
|
animation = true,
|
||||||
isProjectOwner,
|
|
||||||
}) {
|
}) {
|
||||||
const [inFlight, setInFlight] = useState(false)
|
const [inFlight, setInFlight] = useState(false)
|
||||||
const [error, setError] = useState()
|
const [error, setError] = useState()
|
||||||
|
@ -113,7 +111,6 @@ const ShareProjectModal = React.memo(function ShareProjectModal({
|
||||||
return (
|
return (
|
||||||
<ShareProjectContext.Provider
|
<ShareProjectContext.Provider
|
||||||
value={{
|
value={{
|
||||||
isProjectOwner,
|
|
||||||
updateProject,
|
updateProject,
|
||||||
monitorRequest,
|
monitorRequest,
|
||||||
inFlight,
|
inFlight,
|
||||||
|
@ -135,7 +132,6 @@ const ShareProjectModal = React.memo(function ShareProjectModal({
|
||||||
ShareProjectModal.propTypes = {
|
ShareProjectModal.propTypes = {
|
||||||
animation: PropTypes.bool,
|
animation: PropTypes.bool,
|
||||||
handleHide: PropTypes.func.isRequired,
|
handleHide: PropTypes.func.isRequired,
|
||||||
isProjectOwner: PropTypes.bool.isRequired,
|
|
||||||
show: PropTypes.bool.isRequired,
|
show: PropTypes.bool.isRequired,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@ App.component(
|
||||||
export default App.controller(
|
export default App.controller(
|
||||||
'ReactShareProjectModalController',
|
'ReactShareProjectModalController',
|
||||||
function ($scope, eventTracking, ide) {
|
function ($scope, eventTracking, ide) {
|
||||||
$scope.isProjectOwner = false
|
|
||||||
$scope.show = false
|
$scope.show = false
|
||||||
|
|
||||||
$scope.handleHide = () => {
|
$scope.handleHide = () => {
|
||||||
|
@ -25,10 +24,9 @@ export default App.controller(
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.openShareProjectModal = isProjectOwner => {
|
$scope.openShareProjectModal = () => {
|
||||||
eventTracking.sendMBOnce('ide-open-share-modal-once')
|
eventTracking.sendMBOnce('ide-open-share-modal-once')
|
||||||
$scope.$applyAsync(() => {
|
$scope.$applyAsync(() => {
|
||||||
$scope.isProjectOwner = isProjectOwner
|
|
||||||
$scope.show = true
|
$scope.show = true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue