|
@@ -31,6 +31,7 @@ import { ExcludeStrict } from '@ol-types/utils'
|
|
|
import getMeta from '@/utils/meta'
|
|
import getMeta from '@/utils/meta'
|
|
|
import { useFeatureFlag } from '@/shared/context/split-test-context'
|
|
import { useFeatureFlag } from '@/shared/context/split-test-context'
|
|
|
import { sendMB } from '@/infrastructure/event-tracking'
|
|
import { sendMB } from '@/infrastructure/event-tracking'
|
|
|
|
|
+import { debugConsole } from '@/utils/debugging'
|
|
|
|
|
|
|
|
type ProjectAccessProps = {
|
|
type ProjectAccessProps = {
|
|
|
setIsInvitedPeopleScreen: React.Dispatch<React.SetStateAction<boolean>>
|
|
setIsInvitedPeopleScreen: React.Dispatch<React.SetStateAction<boolean>>
|
|
@@ -51,7 +52,7 @@ function ProjectAccess({
|
|
|
null
|
|
null
|
|
|
)
|
|
)
|
|
|
const { isProjectOwner } = useEditorContext()
|
|
const { isProjectOwner } = useEditorContext()
|
|
|
- const { activeGroupSubscriptions } = getMeta('ol-user')
|
|
|
|
|
|
|
+ const { activeProfessionalGroupSubscriptions } = getMeta('ol-user')
|
|
|
const groupSharingEnabled = useFeatureFlag('group-link-sharing')
|
|
const groupSharingEnabled = useFeatureFlag('group-link-sharing')
|
|
|
|
|
|
|
|
const {
|
|
const {
|
|
@@ -92,16 +93,18 @@ function ProjectAccess({
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return data
|
|
return data
|
|
|
- }).then(data => {
|
|
|
|
|
- setSharingLinkData(data)
|
|
|
|
|
- setProjectAccess(newAccess)
|
|
|
|
|
- setSuccessActionMessage(t('access_updated'))
|
|
|
|
|
- sendMB('sharing-link-set-permissions', {
|
|
|
|
|
- project_id: projectId,
|
|
|
|
|
- access_level: newAccess.split('.')[0],
|
|
|
|
|
- ...reqBody,
|
|
|
|
|
- })
|
|
|
|
|
})
|
|
})
|
|
|
|
|
+ .then(data => {
|
|
|
|
|
+ setSharingLinkData(data)
|
|
|
|
|
+ setProjectAccess(newAccess)
|
|
|
|
|
+ setSuccessActionMessage(t('access_updated'))
|
|
|
|
|
+ sendMB('sharing-link-set-permissions', {
|
|
|
|
|
+ project_id: projectId,
|
|
|
|
|
+ access_level: newAccess.split('.')[0],
|
|
|
|
|
+ ...reqBody,
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch(debugConsole.error)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const onAccessSelect = (eventKey: ProjectAccessType) => {
|
|
const onAccessSelect = (eventKey: ProjectAccessType) => {
|
|
@@ -125,27 +128,31 @@ function ProjectAccess({
|
|
|
privileges: eventKey,
|
|
privileges: eventKey,
|
|
|
subscriptionId: sharingLinkData?.subscriptionId,
|
|
subscriptionId: sharingLinkData?.subscriptionId,
|
|
|
})
|
|
})
|
|
|
- ).then(data => {
|
|
|
|
|
- setSharingLinkData(data)
|
|
|
|
|
- setSuccessActionMessage(t('access_updated'))
|
|
|
|
|
- sendMB('sharing-link-set-permissions', {
|
|
|
|
|
- project_id: projectId,
|
|
|
|
|
- access_level: projectAccess?.split('.')[0],
|
|
|
|
|
- privileges: eventKey,
|
|
|
|
|
- subscriptionId: data.subscriptionId,
|
|
|
|
|
|
|
+ )
|
|
|
|
|
+ .then(data => {
|
|
|
|
|
+ setSharingLinkData(data)
|
|
|
|
|
+ setSuccessActionMessage(t('access_updated'))
|
|
|
|
|
+ sendMB('sharing-link-set-permissions', {
|
|
|
|
|
+ project_id: projectId,
|
|
|
|
|
+ access_level: projectAccess?.split('.')[0],
|
|
|
|
|
+ privileges: eventKey,
|
|
|
|
|
+ subscriptionId: data.subscriptionId,
|
|
|
|
|
+ })
|
|
|
})
|
|
})
|
|
|
- })
|
|
|
|
|
|
|
+ .catch(debugConsole.error)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const getGroupLinkText = (id?: string) => {
|
|
const getGroupLinkText = (id?: string) => {
|
|
|
if (
|
|
if (
|
|
|
!id ||
|
|
!id ||
|
|
|
- !activeGroupSubscriptions ||
|
|
|
|
|
- activeGroupSubscriptions.length === 0
|
|
|
|
|
|
|
+ !activeProfessionalGroupSubscriptions ||
|
|
|
|
|
+ activeProfessionalGroupSubscriptions.length === 0
|
|
|
) {
|
|
) {
|
|
|
return ''
|
|
return ''
|
|
|
}
|
|
}
|
|
|
- const subscription = activeGroupSubscriptions.find(sub => sub._id === id)
|
|
|
|
|
|
|
+ const subscription = activeProfessionalGroupSubscriptions.find(
|
|
|
|
|
+ sub => sub._id === id
|
|
|
|
|
+ )
|
|
|
if (subscription?.teamName) {
|
|
if (subscription?.teamName) {
|
|
|
return t('anyone_in_x_with_the_link', {
|
|
return t('anyone_in_x_with_the_link', {
|
|
|
groupName: subscription.teamName,
|
|
groupName: subscription.teamName,
|
|
@@ -252,8 +259,8 @@ function ProjectAccess({
|
|
|
</DropdownItem>
|
|
</DropdownItem>
|
|
|
</DropdownListItem>
|
|
</DropdownListItem>
|
|
|
{groupSharingEnabled &&
|
|
{groupSharingEnabled &&
|
|
|
- activeGroupSubscriptions &&
|
|
|
|
|
- activeGroupSubscriptions.map(subscription => (
|
|
|
|
|
|
|
+ activeProfessionalGroupSubscriptions &&
|
|
|
|
|
+ activeProfessionalGroupSubscriptions.map(subscription => (
|
|
|
<DropdownListItem
|
|
<DropdownListItem
|
|
|
className="d-flex align-items-center"
|
|
className="d-flex align-items-center"
|
|
|
key={subscription._id}
|
|
key={subscription._id}
|