Skip to content

Conversation

martinjagodic
Copy link
Member

@martinjagodic martinjagodic commented Jun 6, 2025

Closes #4675

Adds unpublished entries to collections

Displays a status badge for each entry based on status in the editorial workflow.

@martinjagodic martinjagodic requested a review from Copilot June 6, 2025 12:04
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR integrates unpublished entries into collection views and adds editorial status badges to each entry.

  • Load and select unpublished entries alongside published ones.
  • Merge unpublished entries in the listing component (EntryListing) and pass workflow status to entry cards.
  • Render a status badge in EntryCard with appropriate styling and translations.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/decap-cms-core/src/reducers/editorialWorkflow.ts Guard selector against missing entities, using optional chaining
packages/decap-cms-core/src/components/Collection/Entries/EntryListing.js Added getAllEntries to merge unpublished entries and new props
packages/decap-cms-core/src/components/Collection/Entries/EntryCard.js Introduced WorkflowBadge, TitleIcons and translation support
packages/decap-cms-core/src/components/Collection/Entries/EntriesCollection.js Fetch unpublished entries, extend mapStateToProps and dispatch
packages/decap-cms-core/src/components/Collection/Entries/Entries.js Propagate new props (getWorkflowStatus, getUnpublishedEntries, filterTerm)
Comments suppressed due to low confidence (2)

packages/decap-cms-core/src/components/Collection/Entries/EntryListing.js:3

  • The component uses PropTypes but there’s no import PropTypes from 'prop-types';. Add this import at the top to prevent undefined reference errors.
import React from 'react';

packages/decap-cms-core/src/components/Collection/Entries/EntriesCollection.js:270

  • New unpublished-entry loading logic and state mappings are introduced here—consider adding unit tests for loadUnpublishedEntries, mapStateToProps logic, and the integration path to ensure the editorial workflow loads and merges entries correctly.
loadUnpublishedEntries: (collections) => loadUnpublishedEntries(collections),

@@ -148,7 +148,7 @@ export function selectUnpublishedEntry(state: EditorialWorkflow, collection: str
export function selectUnpublishedEntriesByStatus(state: EditorialWorkflow, status: string) {
if (!state) return null;
const entities = state.get('entities') as Entities;
return entities.filter(entry => entry.get('status') === status).valueSeq();
return entities?.filter(entry => entry.get('status') === status).valueSeq();
Copy link
Preview

Copilot AI Jun 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using optional chaining here can result in returning undefined before calling valueSeq(). Consider explicitly returning an empty sequence (e.g., Immutable.Seq()) when entities is falsy to avoid runtime errors.

Copilot uses AI. Check for mistakes.

@martinjagodic martinjagodic changed the title Feat: EW - add unpublished entries with collections with status badbe Feat: EW - add unpublished entries with collections with status badge Jun 6, 2025
@martinjagodic martinjagodic changed the title Feat: EW - add unpublished entries with collections with status badge Feat: EW - add unpublished entries to collections Jun 6, 2025
@martinjagodic martinjagodic marked this pull request as ready for review June 6, 2025 12:28
@martinjagodic martinjagodic requested a review from a team as a code owner June 6, 2025 12:28
@demshy demshy merged commit 7f8a371 into decaporg:main Jul 11, 2025
7 checks passed
@eerison
Copy link

eerison commented Jul 11, 2025

hey @martinjagodic

Displays a status badge for each entry based on status in the editorial workflow.

does it work out of the box in the next release, or do I need to configure something?
will it works for github pipeline status also?

Thank you in advance.

@domcleal
Copy link
Contributor

does it work out of the box in the next release, or do I need to configure something?

It does, no config needed.

will it works for github pipeline status also?

It's showing the editorial status of draft/in review/ready to publish, not GitHub-specific.

@martinjagodic martinjagodic deleted the feat/add-status-to-entry-card branch July 14, 2025 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

List draft entry in list page (collection)
4 participants