Skip to content

[Content]: Schedule Unpublish Button#4028

Open
geodem127 wants to merge 7 commits intodevfrom
feature/3151-schedule-unpublish-button
Open

[Content]: Schedule Unpublish Button#4028
geodem127 wants to merge 7 commits intodevfrom
feature/3151-schedule-unpublish-button

Conversation

@geodem127
Copy link
Copy Markdown
Contributor

@geodem127 geodem127 commented Mar 25, 2026

  • created schedule unpublished modal component
  • added redux function to process scheduled unpublished
  • updated "ItemEditHeaderActions" to handle scheduling/unscheduling item unpublishings
Screen.Recording.2026-03-26.at.2.20.33.AM.mov

@geodem127 geodem127 changed the title ]Content: Schedule Unpublish Button [Content]: Schedule Unpublish Button Mar 25, 2026
@geodem127 geodem127 requested review from agalin920 and finnar-bin and removed request for agalin920 March 25, 2026 18:23
@geodem127 geodem127 linked an issue Mar 30, 2026 that may be closed by this pull request
@geodem127 geodem127 force-pushed the feature/3151-schedule-unpublish-button branch from 4c2e3e7 to 6609be8 Compare April 11, 2026 19:47
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this not duplicating a ton of stuff we use for SchedulePublish? I would imagine there would be a lot of shared code between them

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Refactored SchedulePublish component to support scheduled un-publishing

@geodem127 geodem127 requested a review from agalin920 April 16, 2026 20:52
@github-actions
Copy link
Copy Markdown
Contributor

Coverage Report

Overall Coverage

Lines Statements Branches Functions
57.33% 57.26% 53.17% 51.88%

Changed Files Coverage

File Lines Statements Branches Functions
src/apps/content-editor/src/app/views/ItemEdit/components/ItemEditHeader/ItemEditHeaderActions.tsx 71.16% 71.04% 78.88% 70.00%
src/shell/components/SchedulePublish/index.tsx 91.48% 91.66% 85.18% 80.00%
src/shell/store/content.js 79.94% 79.52% 71.59% 83.87%

if (item?.dirty) {
return ITEM_STATES.dirty;
} else if (item?.scheduling?.isScheduled) {
} else if (item?.scheduling?.isScheduled && !item?.publishing?.publishAt) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why is item?.publishing?.publishAt being added? I would assume isScheduled already covers this.

Comment on lines +569 to +579
{
users?.find(
(user: any) =>
user.ZUID === activePublishing?.publishedByUserZUID
)?.firstName
}{" "}
{
users?.find(
(user: any) =>
user.ZUID === activePublishing?.publishedByUserZUID
)?.lastName
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would honestly prefer to have this as a variable instead of inline

Comment on lines +688 to +699
{
users?.find(
(user: any) =>
user.ZUID === activePublishing?.publishedByUserZUID
)?.firstName
}{" "}
{
users?.find(
(user: any) =>
user.ZUID === activePublishing?.publishedByUserZUID
)?.lastName
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same for this one, prefer to have this as a variable

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm aware that this file has been this way from the beginning but I honestly find it hard to follow the rendering logic with all the nested ternary operators. Might be worth looking at refactoring this. Thoughts @agalin920 ?

Comment on lines +100 to +101
publishAt: isForUnpublish ? "now" : publishAtUtcStr,
unpublishAt: isForUnpublish ? publishAtUtcStr : "never",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do these need to be changed given that this function is supposed to only handle publishing?

Comment on lines +875 to +885
const message =
(!!data.publishAt && data.publishAt !== "now") ||
(data.publishAt === "now" &&
!!data?.unpublishAt &&
data?.unpublishAt !== "never")
? `Scheduled ${title} to ${
data.publishAt === "now" && data?.unpublishAt !== "never"
? "unpublish"
: "publish"
} on ${meta.localTime} in the ${meta.localTimezone} timezone`
: `Published ${title} now`;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Prefer to have this as an if-else for readability. Kinda hard to follow heavily-nested ternary operations like this.

let actionDispatch = null;

if (isForUnpublish) {
actionDispatch = publish(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not sure why we're doing a publish action when we're supposed to unpublish something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Content: Schedule Unpublish Button

3 participants