Skip to content

[8667] Handle activity with type PUBLISH in the dashboard activities dashlets#4854

Draft
jvega190 wants to merge 2 commits intocraftercms:developfrom
jvega190:enhancement/8667
Draft

[8667] Handle activity with type PUBLISH in the dashboard activities dashlets#4854
jvega190 wants to merge 2 commits intocraftercms:developfrom
jvega190:enhancement/8667

Conversation

@jvega190
Copy link
Copy Markdown
Member

@jvega190 jvega190 commented May 7, 2026

craftercms/craftercms#8667

Summary by CodeRabbit

  • New Features
    • Expanded activity tracking to support comprehensive publishing workflows with new action types for publish operations, including initiation, successful publication, reverting changes, publish cancellation, and rejection handling. The activity dashboard now displays all publication-related actions.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 7, 2026

Review Change Stack

Warning

Rate limit exceeded

@jvega190 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 47 minutes and 19 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6fd99262-3b68-4dd6-8148-7d65464da735

📥 Commits

Reviewing files that changed from the base of the PR and between 9e0c97f and a1c620c.

📒 Files selected for processing (1)
  • ui/app/src/components/ActivityDashlet/utils.tsx

Walkthrough

The PR adds support for the PUBLISH activity type by extending the Activities union type with six new action types and implementing rendering logic in the ActivityDashlet component to handle PUBLISH actions with appropriate labels and messages.

Changes

Add PUBLISH Activity Type Support

Layer / File(s) Summary
Activity Type Definition
ui/app/src/models/Activity.ts
The Activities union type is extended to include PUBLISH, PUBLISHED, INITIAL_PUBLISH, REVERT, REJECT_PUBLISH_PACKAGE, and CANCEL_PUBLISH_PACKAGE action types; prior TODO comments about backend mappings are removed.
Dashboard Activity Rendering
ui/app/src/components/ActivityDashlet/utils.tsx
The renderActivity switch statement adds a PUBLISH case that returns the published activity message; activityNameLookup changes its key from APPROVE to PUBLISH with the same "Approve" label content.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related issues

  • craftercms/craftercms#8667: PR adds explicit PUBLISH activity support to the Activities union type and ActivityDashlet rendering, directly addressing this issue's request for PUBLISH activity handling in activity dashlets.

Possibly related PRs

  • craftercms/studio-ui#4830: Both PRs modify renderActivity in ActivityDashlet/utils.tsx to adjust publish-related action rendering; this PR adds PUBLISH handling while the other PR adjusts REQUEST_PUBLISH rendering.

Suggested reviewers

  • rart
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description only contains a link to the issue with no additional context about the changes, missing substantive details about what was modified. Expand the description to explain the changes made (e.g., new PUBLISH action handling, updated activity type union), implementation rationale, and testing performed.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding handling for PUBLISH activity type in dashboard activities dashlets.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
ui/app/src/components/ActivityDashlet/utils.tsx (1)

134-141: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Duplicate id causes wrong translation for PUBLISH in non-English locales.

The new PUBLISH case reuses id="activityDashlet.publishedActivityMessage", the same ID already used by both PUBLISHED ("Published…") and REJECT_PUBLISH_PACKAGE ("Rejected…"). The FormattedMessage id prop matches a specific key in the translation file and returns the corresponding string for the current locale. When a translation file provides a value for activityDashlet.publishedActivityMessage, the defaultMessage is bypassed and all three cases will render the identical translated string — making "Approved a package", "Rejected a package", and "Published a package" indistinguishable from each other in any translated locale.

The PUBLISH case needs its own unique ID:

🌐 Proposed fix
-		case 'PUBLISH':
-			return (
-				<FormattedMessage
-					id="activityDashlet.publishedActivityMessage"
-					defaultMessage="Approved <render_package_link>a package</render_package_link>"
-					values={{ render_package_link }}
-				/>
-			);
+		case 'PUBLISH':
+			return (
+				<FormattedMessage
+					id="activityDashlet.approvedActivityMessage"
+					defaultMessage="Approved <render_package_link>a package</render_package_link>"
+					values={{ render_package_link }}
+				/>
+			);

Note: REJECT_PUBLISH_PACKAGE (line 142) shares the same id="activityDashlet.publishedActivityMessage" with PUBLISHED — that pre-existing collision is worth fixing in a follow-up.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ui/app/src/components/ActivityDashlet/utils.tsx` around lines 134 - 141, The
PUBLISH case in utils.tsx reuses id="activityDashlet.publishedActivityMessage"
which causes translation collisions; update the FormattedMessage id in the
PUBLISH branch (the JSX returned inside the case 'PUBLISH') to a unique key
(e.g. "activityDashlet.approvedActivityMessage"), keep the same defaultMessage
and values={ render_package_link }, and ensure the new id is added to the
translation files; (note: do not change the existing
PUBLISHED/REJECT_PUBLISH_PACKAGE branches here—address their collision in a
separate follow-up).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@ui/app/src/components/ActivityDashlet/utils.tsx`:
- Around line 134-141: The PUBLISH case in utils.tsx reuses
id="activityDashlet.publishedActivityMessage" which causes translation
collisions; update the FormattedMessage id in the PUBLISH branch (the JSX
returned inside the case 'PUBLISH') to a unique key (e.g.
"activityDashlet.approvedActivityMessage"), keep the same defaultMessage and
values={ render_package_link }, and ensure the new id is added to the
translation files; (note: do not change the existing
PUBLISHED/REJECT_PUBLISH_PACKAGE branches here—address their collision in a
separate follow-up).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c0ae0569-92e4-44b1-8e27-270cee11f42c

📥 Commits

Reviewing files that changed from the base of the PR and between 77d7965 and 9e0c97f.

📒 Files selected for processing (2)
  • ui/app/src/components/ActivityDashlet/utils.tsx
  • ui/app/src/models/Activity.ts

@jvega190
Copy link
Copy Markdown
Member Author

jvega190 commented May 7, 2026

Outside diff range comments addressed

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.

1 participant