feat(activity-feed-v2): Wire task action and edit callbacks#4582
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughAdds inline task editing to ActivityFeedV2 with paginated collaborator loading, assignment-status update callbacks, ActivitySidebar collaborator API wrapper, permission-aware task actions in FeedItemRow, and related tests/transformer flag for assignee pagination. ChangesInline Task Editing and Collaborator Assignment Updates
Sequence Diagram(s)sequenceDiagram
participant ActivitySidebar
participant ActivityFeedV2
participant FeedItemRow
participant TaskCollaboratorsAPI
participant TaskModal
ActivitySidebar->>ActivityFeedV2: pass getTaskCollaborators, onTaskAssignmentUpdate, onTaskUpdate props
FeedItemRow->>ActivityFeedV2: onTaskEdit(task)
ActivityFeedV2->>TaskCollaboratorsAPI: getTaskCollaborators(task) (if assigned_to.next_marker)
TaskCollaboratorsAPI-->>ActivityFeedV2: TaskAssigneeCollection
ActivityFeedV2->>TaskModal: open(editMode=true, taskFormProps with approvers and editTask=onTaskUpdate)
TaskModal-->>ActivityFeedV2: onTaskUpdate(payload, onSuccess/onError)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
- Approve/Reject/Complete via onTaskAssignmentUpdate, gated on assignment + can_update + NOT_STARTED so the vendor TaskItem hides buttons the user cannot act on - Edit via onTaskUpdate, refetching assignees through getTaskCollaborators when next_marker is set so the form sees the full list - hasNextPage on the task transformer - Tighten onTaskUpdate.onError to (error, code)
4a0b7c7 to
451f95b
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@src/elements/content-sidebar/activity-feed-v2/ActivityFeedV2.tsx`:
- Around line 168-191: handleTaskEdit currently only logs failures to the
console when getTaskCollaborators is missing or throws, causing the edit flow to
silently fail; update handleTaskEdit to provide user-facing feedback by opening
the task form modal (setIsTaskFormOpen(true)) and setting an error state or
calling the existing UI error notifier (e.g., setTaskFormError,
showNotification, or similar) when getTaskCollaborators is unavailable or
throws, while still avoiding setting editingTask/assignees if loading failed;
reference handleTaskEdit, getTaskCollaborators, setIsTaskFormOpen,
setEditingTask, setEditingAssignees and add or reuse a UI error handler to
display a clear message like "Failed to load assignees" so users see why the
edit did not proceed.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 12bdd007-62c2-40a8-a447-b7d862d135a9
📒 Files selected for processing (7)
src/elements/content-sidebar/ActivitySidebar.jssrc/elements/content-sidebar/activity-feed-v2/ActivityFeedV2.tsxsrc/elements/content-sidebar/activity-feed-v2/FeedItemRow.tsxsrc/elements/content-sidebar/activity-feed-v2/__tests__/FeedItemRow.test.tsxsrc/elements/content-sidebar/activity-feed-v2/__tests__/transformers.test.tssrc/elements/content-sidebar/activity-feed-v2/transformers.tssrc/elements/content-sidebar/activity-feed-v2/types.ts
Pre-fetching paginated assignees is best-effort enrichment. When the fetch fails or the consumer did not provide getTaskCollaborators, open the modal anyway with whatever assignees the activity payload returned instead of silently swallowing the click. TaskForm.getRemovedAssignees only diffs against loaded assignees, so unloaded ones survive submit.
Merge Queue Status
This pull request spent 10 minutes 14 seconds in the queue, including 9 minutes 57 seconds running CI. Required conditions to merge
|
Summary
Wires the remaining Task callbacks in the ActivityFeedV2 adapter (the sidebar surface that wraps the @box/activity-feed shared feature). Before this change only Delete and View were wired.
onTaskAssignmentUpdate. Gated on the current user having an assignment withcan_updatepermission andNOT_STARTEDstatus, so the vendorTaskItemhides the buttons the user cannot act on instead of rendering them as no-ops.onTaskUpdate. Whenassigned_to.next_markeris set on the task, refetches the full assignee list through a newgetTaskCollaboratorscallback before opening the modal, soTaskFormsees every assignee.hasNextPageadded on the task transformer (drives the row-level "Show More" affordance).onTaskUpdate'sonErrorfrom() => voidto(error: unknown, code?: string) => voidto match what callers actually receive.No changes to
@box/activity-feed; the shared feature already exposed every callback this PR plumbs through.Test plan
yarn test --watchAll=false --testPathPattern="activity-feed-v2|ActivitySidebar"(313/313)npx tsc --noEmit -p tsconfig.jsonNOT_STARTEDgetTaskCollaboratorsis unreachable (error log, modal does not open)Summary by CodeRabbit
New Features
Tests