Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(stega): remove isDraft search param #978

Merged
merged 1 commit into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/csm/createEditUrl.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {getPublishedId, getVersionFromId, isDraftId, isPublishedId, isVersionId} from './draftUtils'
import {getPublishedId, getVersionFromId, isPublishedId, isVersionId} from './draftUtils'
import {jsonPathToStudioPath} from './jsonPath'
import * as studioPath from './studioPath'
import type {CreateEditUrlOptions, EditIntentUrl, StudioBaseUrl} from './types'
Expand Down Expand Up @@ -62,9 +62,6 @@ export function createEditUrl(options: CreateEditUrlOptions): `${StudioBaseUrl}$
const versionId = getVersionFromId(_id)!
searchParams.set('perspective', versionId)
}
if (isDraftId(_id)) {
searchParams.set('isDraft', '')
}

const segments = [baseUrl === '/' ? '' : baseUrl]
if (workspace) {
Expand Down
8 changes: 4 additions & 4 deletions test/csm/createEditUrl.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,25 @@ const cases = [
context: {baseUrl, workspace, tool, id, type},
path: parseJsonPath("$['foo'][?(@._key=='section-1')][0]['baz'][?(@._key=='section-2')]"),
expected:
'https://test.sanity.studio/staging/intent/edit/mode=presentation;id=homepage;type=page;path=foo[_key=="section-1"][0].baz[_key=="section-2"];tool=content?baseUrl=https://test.sanity.studio&id=homepage&type=page&path=foo[_key=="section-1"][0].baz[_key=="section-2"]&workspace=staging&tool=content&isDraft=',
'https://test.sanity.studio/staging/intent/edit/mode=presentation;id=homepage;type=page;path=foo[_key=="section-1"][0].baz[_key=="section-2"];tool=content?baseUrl=https://test.sanity.studio&id=homepage&type=page&path=foo[_key=="section-1"][0].baz[_key=="section-2"]&workspace=staging&tool=content',
},
{
context: {baseUrl: '/', id, type},
path: parseJsonPath("$['foo'][?(@._key=='section-1')][0]"),
expected:
'/intent/edit/mode=presentation;id=homepage;type=page;path=foo[_key=="section-1"][0]?baseUrl=/&id=homepage&type=page&path=foo[_key=="section-1"][0]&isDraft=',
'/intent/edit/mode=presentation;id=homepage;type=page;path=foo[_key=="section-1"][0]?baseUrl=/&id=homepage&type=page&path=foo[_key=="section-1"][0]',
},
{
context: {baseUrl: '/', workspace, tool, id, type},
path: parseJsonPath("$['foo'][?(@._key=='section-1')][0]"),
expected:
'/staging/intent/edit/mode=presentation;id=homepage;type=page;path=foo[_key=="section-1"][0];tool=content?baseUrl=/&id=homepage&type=page&path=foo[_key=="section-1"][0]&workspace=staging&tool=content&isDraft=',
'/staging/intent/edit/mode=presentation;id=homepage;type=page;path=foo[_key=="section-1"][0];tool=content?baseUrl=/&id=homepage&type=page&path=foo[_key=="section-1"][0]&workspace=staging&tool=content',
},
{
context: {baseUrl: '/', workspace, tool, id, type, projectId, dataset},
path: parseJsonPath("$['foo'][?(@._key=='section-1')][0]"),
expected:
'/staging/intent/edit/mode=presentation;id=homepage;type=page;path=foo[_key=="section-1"][0];tool=content?baseUrl=/&id=homepage&type=page&path=foo[_key=="section-1"][0]&workspace=staging&tool=content&projectId=a1b2c3d4&dataset=production&isDraft=',
'/staging/intent/edit/mode=presentation;id=homepage;type=page;path=foo[_key=="section-1"][0];tool=content?baseUrl=/&id=homepage&type=page&path=foo[_key=="section-1"][0]&workspace=staging&tool=content&projectId=a1b2c3d4&dataset=production',
},
{
context: {baseUrl: '/', workspace, tool, id: getPublishedId(id), type, projectId, dataset},
Expand Down
6 changes: 3 additions & 3 deletions test/csm/resolveEditUrl.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -519,19 +519,19 @@ const cases = [
path: 'products[1].title',
studioUrl: 'https://test.sanity.studio',
expected:
'https://test.sanity.studio/intent/edit/mode=presentation;id=807cc05c-8c4c-443a-a9c1-198fd3fd7b16;type=product;path=title?baseUrl=https://test.sanity.studio&id=807cc05c-8c4c-443a-a9c1-198fd3fd7b16&type=product&path=title&isDraft=',
'https://test.sanity.studio/intent/edit/mode=presentation;id=807cc05c-8c4c-443a-a9c1-198fd3fd7b16;type=product;path=title?baseUrl=https://test.sanity.studio&id=807cc05c-8c4c-443a-a9c1-198fd3fd7b16&type=product&path=title',
},
{
path: 'products[1].media.alt',
studioUrl: '/',
expected:
'/intent/edit/mode=presentation;id=807cc05c-8c4c-443a-a9c1-198fd3fd7b16;type=product;path=media[_key=="55659c72ec46"].alt?baseUrl=/&id=807cc05c-8c4c-443a-a9c1-198fd3fd7b16&type=product&path=media[_key=="55659c72ec46"].alt&isDraft=',
'/intent/edit/mode=presentation;id=807cc05c-8c4c-443a-a9c1-198fd3fd7b16;type=product;path=media[_key=="55659c72ec46"].alt?baseUrl=/&id=807cc05c-8c4c-443a-a9c1-198fd3fd7b16&type=product&path=media[_key=="55659c72ec46"].alt',
},
{
path: 'products[1].description[0].children[0].text',
studioUrl: '/',
expected:
'/intent/edit/mode=presentation;id=807cc05c-8c4c-443a-a9c1-198fd3fd7b16;type=product;path=description[0].children[0].text?baseUrl=/&id=807cc05c-8c4c-443a-a9c1-198fd3fd7b16&type=product&path=description[0].children[0].text&isDraft=',
'/intent/edit/mode=presentation;id=807cc05c-8c4c-443a-a9c1-198fd3fd7b16;type=product;path=description[0].children[0].text?baseUrl=/&id=807cc05c-8c4c-443a-a9c1-198fd3fd7b16&type=product&path=description[0].children[0].text',
},
{
path: 'products[2].title',
Expand Down
Loading