Skip to content

feat(activity-feed-v2): Wire task action and edit callbacks#4582

Merged
mergify[bot] merged 3 commits into
box:masterfrom
jackiejou:feat/activity-feed-v2-task-callbacks
May 21, 2026
Merged

feat(activity-feed-v2): Wire task action and edit callbacks#4582
mergify[bot] merged 3 commits into
box:masterfrom
jackiejou:feat/activity-feed-v2-task-callbacks

Conversation

@jackiejou
Copy link
Copy Markdown
Contributor

@jackiejou jackiejou commented May 21, 2026

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.

  • Approve / Reject / Complete: via onTaskAssignmentUpdate. Gated on the current user having an assignment with can_update permission and NOT_STARTED status, so the vendor TaskItem hides the buttons the user cannot act on instead of rendering them as no-ops.
  • Edit: via onTaskUpdate. When assigned_to.next_marker is set on the task, refetches the full assignee list through a new getTaskCollaborators callback before opening the modal, so TaskForm sees every assignee.
  • hasNextPage added on the task transformer (drives the row-level "Show More" affordance).
  • Tightens onTaskUpdate's onError from () => void to (error: unknown, code?: string) => void to 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.json
  • Manual: open a task in the v2 sidebar, click Approve / Reject / Complete, confirm the assignment status updates
  • Manual: confirm Approve / Reject / Complete buttons are hidden for non-assigned users and for assignments not in NOT_STARTED
  • Manual: edit a task, confirm the modal opens with all assignees pre-populated and submit succeeds
  • Manual: confirm edit is gracefully blocked when the activity payload returns a paginated assignee list and getTaskCollaborators is unreachable (error log, modal does not open)

Summary by CodeRabbit

  • New Features

    • Inline task editing from the activity feed with edit-mode task modal and populated edit form
    • Loading full assignee lists when assignments are paginated; UI indicates additional assignee pages
    • Task assignment actions (approve/complete/reject) with permission/status gating and assignment-update handling
  • Tests

    • Expanded coverage for assignment update flows, permission/status gating, edit wiring, and collaborator pagination

Review Change Stack

@jackiejou jackiejou requested review from a team as code owners May 21, 2026 15:41
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 21, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ea03b276-a8c5-4005-b0fa-410a3e26a838

📥 Commits

Reviewing files that changed from the base of the PR and between c06ad6d and c0fec5f.

📒 Files selected for processing (2)
  • src/elements/content-sidebar/activity-feed-v2/__tests__/transformers.test.ts
  • src/elements/content-sidebar/activity-feed-v2/transformers.ts

Walkthrough

Adds 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.

Changes

Inline Task Editing and Collaborator Assignment Updates

Layer / File(s) Summary
Type contracts and collaborator API integration
src/elements/content-sidebar/activity-feed-v2/types.ts, src/elements/content-sidebar/ActivitySidebar.js
ActivityFeedV2Props adds getTaskCollaborators and onTaskAssignmentUpdate; onTaskUpdate signature updated. ActivitySidebar imports TaskAssigneeCollection, wraps collaborators API in getTaskCollaborators, and wires the new props to ActivityFeedV2.
Edit modal state and handler logic in ActivityFeedV2
src/elements/content-sidebar/activity-feed-v2/ActivityFeedV2.tsx
Adds editingTask/editingAssignees state, async handleTaskEdit to fetch paginated assignees via getTaskCollaborators, and renders TaskModal in edit mode with populated taskFormProps and editTask: onTaskUpdate.
Task rendering with permission-aware actions in FeedItemRow
src/elements/content-sidebar/activity-feed-v2/FeedItemRow.tsx
Renders task items by locating the current user assignment, enables approve/complete/reject only when can_update and TASK_NEW_NOT_STARTED, and wires onTaskAssignmentUpdate, onTaskEdit, and onTaskDelete callbacks.
Pagination support and test coverage
src/elements/content-sidebar/activity-feed-v2/transformers.ts, src/elements/content-sidebar/activity-feed-v2/__tests__/FeedItemRow.test.tsx, src/elements/content-sidebar/activity-feed-v2/__tests__/transformers.test.ts
transformTaskToProps exposes hasNextPage from assigned_to.next_marker. Tests cover assignee pagination and task assignment callback behaviors across permission/status/user conditions.

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)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • box/box-ui-elements#4533: Main PR extends the existing ActivityFeedV2/FeedItemRow adapter from PR #4533 by adding task-assignee/collaborator fetching and task assignment edit wiring (getTaskCollaborators, onTaskAssignmentUpdate, task modal editMode) in the same feed/task rendering code paths.
  • box/box-ui-elements#4460: Both PRs modify the same ActivitySidebar feature-flag wiring to render ActivityFeedV2, and they also touch the activity-feed-v2/ActivityFeedV2.tsx implementation.

Suggested labels

ready-to-merge

Suggested reviewers

  • reneshen0328
  • ahorowitz123
  • kduncanhsu

Poem

🐰 I hopped through props and types all day,
Pulled collaborators down a paged pathway.
A modal bloomed where edits could start,
Permissions checked, each assignment part.
Hooray — tasks now dance in the sidebar heart!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and specifically summarizes the main change: wiring task action and edit callbacks in the activity-feed-v2 component.
Description check ✅ Passed The PR description is comprehensive and well-structured, providing clear summary of changes, rationale, specific implementation details, and a detailed test plan, far exceeding the provided template requirements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

- 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)
@jackiejou jackiejou force-pushed the feat/activity-feed-v2-task-callbacks branch from 4a0b7c7 to 451f95b Compare May 21, 2026 15:46
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.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 4a0b7c7 and 451f95b.

📒 Files selected for processing (7)
  • src/elements/content-sidebar/ActivitySidebar.js
  • src/elements/content-sidebar/activity-feed-v2/ActivityFeedV2.tsx
  • src/elements/content-sidebar/activity-feed-v2/FeedItemRow.tsx
  • src/elements/content-sidebar/activity-feed-v2/__tests__/FeedItemRow.test.tsx
  • src/elements/content-sidebar/activity-feed-v2/__tests__/transformers.test.ts
  • src/elements/content-sidebar/activity-feed-v2/transformers.ts
  • src/elements/content-sidebar/activity-feed-v2/types.ts

Comment thread src/elements/content-sidebar/activity-feed-v2/ActivityFeedV2.tsx
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.
Copy link
Copy Markdown
Contributor

@kduncanhsu kduncanhsu left a comment

Choose a reason for hiding this comment

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

lgtm

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented May 21, 2026

Merge Queue Status

  • Entered queue2026-05-21 23:26 UTC · Rule: Automatic strict merge
  • Checks passed · in-place
  • Merged2026-05-21 23:37 UTC · at c0fec5f36e41916b3e92ec50dc9f24a34c1dc8e0 · squash

This pull request spent 10 minutes 14 seconds in the queue, including 9 minutes 57 seconds running CI.

Required conditions to merge

@mergify mergify Bot merged commit 95bca8c into box:master May 21, 2026
10 of 11 checks passed
@mergify mergify Bot removed the queued label May 21, 2026
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.

5 participants