Skip to content

Commit 503bf03

Browse files
committed
fix(sanity): support Drafts perspective (_originalId) in Studio structure draft & release filters
1 parent 9673813 commit 503bf03

1 file changed

Lines changed: 16 additions & 12 deletions

File tree

‎apps/sanity/structure.ts‎

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export const editorialStructure: StructureResolver = (S) =>
5656
S.documentList()
5757
.title("Drafts (In Progress)")
5858
.filter(
59-
'_type in ["post", "podcast"] && _id in path("drafts.**")',
59+
'_type in ["post", "podcast"] && (_id in path("drafts.**") || _originalId in path("drafts.**"))',
6060
)
6161
.defaultOrdering([
6262
{ field: "_updatedAt", direction: "desc" },
@@ -68,7 +68,7 @@ export const editorialStructure: StructureResolver = (S) =>
6868
S.documentList()
6969
.title("In Content Releases")
7070
.filter(
71-
'_type in ["post", "podcast"] && _id in path("versions.**")',
71+
'_type in ["post", "podcast"] && (_id in path("versions.**") || _originalId in path("versions.**"))',
7272
)
7373
.defaultOrdering([
7474
{ field: "_updatedAt", direction: "desc" },
@@ -165,9 +165,7 @@ export const editorialStructure: StructureResolver = (S) =>
165165
S.listItem()
166166
.title("Outbound Prospects (Sponsor Pool)")
167167
.child(
168-
S.documentTypeList("sponsorPool").title(
169-
"Outbound Prospects",
170-
),
168+
S.documentTypeList("sponsorPool").title("Outbound Prospects"),
171169
),
172170
S.divider(),
173171
S.listItem()
@@ -206,7 +204,9 @@ export const editorialStructure: StructureResolver = (S) =>
206204
S.documentList()
207205
.title("Draft Posts")
208206
.schemaType("post")
209-
.filter('_type == "post" && _id in path("drafts.**")')
207+
.filter(
208+
'_type == "post" && (_id in path("drafts.**") || _originalId in path("drafts.**"))',
209+
)
210210
.defaultOrdering([
211211
{ field: "_updatedAt", direction: "desc" },
212212
]),
@@ -291,7 +291,9 @@ export const editorialStructure: StructureResolver = (S) =>
291291
S.documentList()
292292
.title("Drafts & Upcoming Episodes")
293293
.schemaType("podcast")
294-
.filter('_type == "podcast" && _id in path("drafts.**")')
294+
.filter(
295+
'_type == "podcast" && (_id in path("drafts.**") || _originalId in path("drafts.**"))',
296+
)
295297
.defaultOrdering([
296298
{ field: "_updatedAt", direction: "desc" },
297299
]),
@@ -387,7 +389,9 @@ export const editorialStructure: StructureResolver = (S) =>
387389
S.divider(),
388390

389391
// 4. People & Sponsors
390-
S.documentTypeListItem("author").title("Authors").icon(FaCat),
392+
S.documentTypeListItem("author")
393+
.title("Authors")
394+
.icon(FaCat),
391395
S.documentTypeListItem("guest").title("Guests").icon(UserIcon),
392396
S.documentTypeListItem("sponsor")
393397
.title("Sponsors")
@@ -434,9 +438,7 @@ export const editorialStructure: StructureResolver = (S) =>
434438
.filter(
435439
'_type == "trendSignal" && status == "discovered" && score >= 70',
436440
)
437-
.defaultOrdering([
438-
{ field: "score", direction: "desc" },
439-
]),
441+
.defaultOrdering([{ field: "score", direction: "desc" }]),
440442
),
441443
S.listItem()
442444
.title("Published / Covered")
@@ -565,7 +567,9 @@ export const editorialStructure: StructureResolver = (S) =>
565567
S.documentList()
566568
.title("AWS Builder Center Links")
567569
.schemaType("syndication")
568-
.filter('_type == "syndication" && platform == "awsbuilder"'),
570+
.filter(
571+
'_type == "syndication" && platform == "awsbuilder"',
572+
),
569573
),
570574
S.listItem()
571575
.title("By Platform: Medium")

0 commit comments

Comments
 (0)