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