-
Notifications
You must be signed in to change notification settings - Fork 429
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): add option to expand draft events
- Loading branch information
1 parent
7398e4d
commit ddfa22a
Showing
9 changed files
with
216 additions
and
383 deletions.
There are no files selected for viewing
263 changes: 0 additions & 263 deletions
263
packages/sanity/src/core/store/events/collapseDraftEvents.test.ts
This file was deleted.
Oops, something went wrong.
43 changes: 0 additions & 43 deletions
43
packages/sanity/src/core/store/events/collapseDraftEvents.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { | ||
type DocumentGroupEvent, | ||
isCreateDocumentVersionEvent, | ||
isPublishDocumentVersionEvent, | ||
} from './types' | ||
|
||
/** | ||
* This function adds additional | ||
*/ | ||
export function decorateEvents(events: DocumentGroupEvent[]) { | ||
events.forEach((event, index) => { | ||
if (isPublishDocumentVersionEvent(event)) { | ||
// Find the creation event for this published event | ||
const creationEvent = events.slice(index + 1).find((e) => isCreateDocumentVersionEvent(e)) | ||
if (creationEvent) { | ||
// If we found a creation event, we should add it to the publish event | ||
event.creationEvent = creationEvent | ||
creationEvent.parentId = event.id | ||
} | ||
} | ||
}) | ||
} |
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
Oops, something went wrong.