diff --git a/services/web/frontend/js/features/share-project-modal/components/link-sharing.js b/services/web/frontend/js/features/share-project-modal/components/link-sharing.js index 9294ab484e..7f7bdf4b42 100644 --- a/services/web/frontend/js/features/share-project-modal/components/link-sharing.js +++ b/services/web/frontend/js/features/share-project-modal/components/link-sharing.js @@ -8,6 +8,7 @@ import { setProjectAccessLevel } from '../utils/api' import CopyLink from '../../../shared/components/copy-link' import { useProjectContext } from '../../../shared/context/project-context' import * as eventTracking from '../../../infrastructure/event-tracking' +import { useUserContext } from '../../../shared/context/user-context' export default function LinkSharing() { const [inflight, setInflight] = useState(false) @@ -204,6 +205,8 @@ export function ReadOnlyTokenLink() { } function AccessToken({ token, path, tooltipId }) { + const { isAdmin } = useUserContext() + if (!token) { return (
@@ -214,7 +217,11 @@ function AccessToken({ token, path, tooltipId }) { ) } - const link = `${window.location.origin}${path}${token}` + let origin = window.location.origin + if (isAdmin) { + origin = window.ExposedSettings.siteUrl + } + const link = `${origin}${path}${token}` return (diff --git a/services/web/frontend/js/shared/context/user-context.js b/services/web/frontend/js/shared/context/user-context.js index 4809c1a9a4..392d6970fc 100644 --- a/services/web/frontend/js/shared/context/user-context.js +++ b/services/web/frontend/js/shared/context/user-context.js @@ -8,6 +8,7 @@ UserContext.Provider.propTypes = { value: PropTypes.shape({ user: PropTypes.shape({ id: PropTypes.string, + isAdmin: PropTypes.boolean, email: PropTypes.string, allowedFreeTrial: PropTypes.boolean, first_name: PropTypes.string,