-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Sanity] Updated custom publish actions (#3315)
* sanity config cleanup * removed extra const for type * re-organized admin tools and fixed types * Removed no longer needed custom actions for translations * Simplified publication plugin * Removed extra logic in publish action * synced SEO-updates * lock sync * bug: Removed old index export
- Loading branch information
Showing
9 changed files
with
48 additions
and
220 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
aksel.nav.no/website/sanity/plugins/publication-flow/actions/createPublishWithDateAction.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { DocumentActionComponent, useDocumentOperation } from "sanity"; | ||
|
||
export function createPublishWithDateAction( | ||
originalAction: DocumentActionComponent, | ||
): DocumentActionComponent { | ||
return (props) => { | ||
const originalResult = originalAction(props); | ||
|
||
const { patch } = useDocumentOperation(props.id, props.type); | ||
if (!originalResult) { | ||
return null; | ||
} | ||
return { | ||
...originalResult, | ||
onHandle: () => { | ||
patch.execute([ | ||
{ setIfMissing: { publishedAt: new Date().toISOString() } }, | ||
]); | ||
originalResult?.onHandle?.(); | ||
}, | ||
}; | ||
}; | ||
} |
44 changes: 0 additions & 44 deletions
44
aksel.nav.no/website/sanity/plugins/publication-flow/actions/defaultPublish.tsx
This file was deleted.
Oops, something went wrong.
25 changes: 0 additions & 25 deletions
25
aksel.nav.no/website/sanity/plugins/publication-flow/actions/delete.ts
This file was deleted.
Oops, something went wrong.
24 changes: 0 additions & 24 deletions
24
aksel.nav.no/website/sanity/plugins/publication-flow/actions/discardChanges.ts
This file was deleted.
Oops, something went wrong.
25 changes: 0 additions & 25 deletions
25
aksel.nav.no/website/sanity/plugins/publication-flow/actions/duplicate.ts
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
aksel.nav.no/website/sanity/plugins/publication-flow/actions/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,3 @@ | ||
export * from "./approve"; | ||
export * from "./delete"; | ||
export * from "./discardChanges"; | ||
export * from "./duplicate"; | ||
export * from "./focusAction"; | ||
export * from "./restore"; | ||
export * from "./unpublish"; | ||
export * from "./updateAction"; | ||
export * from "./defaultPublish"; |
25 changes: 0 additions & 25 deletions
25
aksel.nav.no/website/sanity/plugins/publication-flow/actions/restore.ts
This file was deleted.
Oops, something went wrong.
26 changes: 0 additions & 26 deletions
26
aksel.nav.no/website/sanity/plugins/publication-flow/actions/unpublish.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters