Skip to content

fix(activity-feed-v2): preserve timestamp markup when editing video comment#4638

Merged
mergify[bot] merged 2 commits into
box:masterfrom
jackiejou:fix/activity-feed-v2-video-timestamp-edit
Jun 17, 2026
Merged

fix(activity-feed-v2): preserve timestamp markup when editing video comment#4638
mergify[bot] merged 2 commits into
box:masterfrom
jackiejou:fix/activity-feed-v2-video-timestamp-edit

Conversation

@jackiejou

@jackiejou jackiejou commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Video comments encode their frame timestamp inline as a #[timestamp:NNN,versionId:NNN] markup prefix on the comment message. The transformer strips that prefix for display, so the editor only contains the visible text and editing the comment dropped the markup from the payload, which lost the badge on the comment.
  • Capture the original markup token in extractTimestampMarkup, expose it on TransformedCommentItem as annotationTimestampMarkup, and re-prepend it to the serialized text when the root of a video comment is edited. Replies and non-timestamped comments are unchanged. Annotations are not affected because they store the timestamp on target.location, separate from the message.

Test Plan

  • yarn test --watchAll=false --testPathPattern="activity-feed-v2" (217 passed)
  • Manually edit a video comment with a frame timestamp in the v2 feed and confirm the timestamp badge survives the edit
  • Edit a regular (non-video) comment and confirm the message is updated as before
  • Edit a reply on a video-timestamped comment and confirm the parent badge is preserved

Summary by CodeRabbit

  • Bug Fixes

    • Fixed timestamp information being lost when editing timestamped comments. Timestamp markup is now correctly preserved during edits.
  • Tests

    • Added test coverage for timestamp preservation in comment edits and timestamp markup extraction validation.

…omment

Video comments encode the frame timestamp inline as a
#[timestamp:NNN,versionId:NNN] markup prefix on the comment message.
The transformer strips that prefix for display, but the editor only
contains the visible text, so editing the comment dropped the markup
from the payload and the badge was lost.

Capture the original markup token in extractTimestampMarkup, store it
on TransformedCommentItem, and re-prepend it to the serialized text
when the root comment is edited. Replies and non-timestamped comments
are unchanged.
@jackiejou
jackiejou requested review from a team as code owners June 17, 2026 22:50
@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

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: 87ea37e3-bb7d-48d0-9d5c-7733ff1bb23c

📥 Commits

Reviewing files that changed from the base of the PR and between f7ecc3a and 41c379b.

📒 Files selected for processing (5)
  • 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

Walkthrough

Adds an annotationTimestampMarkup field to TransformedCommentItem. extractTimestampMarkup now returns the raw #[timestamp:...] prefix string alongside the cleaned text. transformFeedItem stores this as annotationTimestampMarkup on transformed comments. FeedItemRow's comment edit handler re-prepends that markup to the edited text before calling onCommentUpdate.

Changes

Timestamp Markup Preservation on Comment Edit

Layer / File(s) Summary
Type contract and extractor return type
activity-feed-v2/types.ts, activity-feed-v2/transformers.ts
TransformedCommentItem adds annotationTimestampMarkup?: string; extractTimestampMarkup's return type is expanded with the same optional field.
Transformer implementation and tests
activity-feed-v2/transformers.ts, activity-feed-v2/__tests__/transformers.test.ts
extractTimestampMarkup sets timestampMarkup from the matched prefix (trimmed); transformFeedItem assigns it to annotationTimestampMarkup on the output comment. Tests assert the field is populated for timestamped comments and undefined for regular ones.
FeedItemRow edit handler and tests
activity-feed-v2/FeedItemRow.tsx, activity-feed-v2/__tests__/FeedItemRow.test.tsx
handleEdit conditionally prepends item.annotationTimestampMarkup to the serialized text before calling onCommentUpdate. Tests verify markup is re-prepended for video timestamped comments and omitted for regular comments.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • box/box-ui-elements#4557: Modifies the same FeedItemRow.tsx comment edit flow and onCommentUpdate text serialization path that this PR builds on.
  • box/box-ui-elements#4620: Extends extractTimestampMarkup in the same transformers.ts file to parse timestampMs, overlapping directly with this PR's expansion of the same function's return value.
  • box/box-ui-elements#4611: Modifies activity-feed-v2 timestamp markup handling in both transformers.ts and FeedItemRow.tsx, the same two files changed here.

Suggested labels

ready-to-merge

Suggested reviewers

  • ahorowitz123
  • JChan106

Poem

🐰 A timestamp I found, tucked away in the text,
When editing comments, I preserve what comes next.
The #[timestamp:...] prefix, I trim and I store,
Then re-prepend on edit — no markup lost anymore!
Hop hop, the badge stays, the video too! 🎬

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The description provides a comprehensive summary of the problem, solution, and test plan, but does not follow the repository's required template structure. Consider following the repository's PR template by addressing the mergify instructions and ensuring all template sections are completed before merging.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: preserving timestamp markup when editing video comments in activity-feed-v2.
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.

@mergify mergify Bot added the queued label Jun 17, 2026
@mergify

mergify Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • Entered queue2026-06-17 23:59 UTC · Rule: Automatic strict merge
  • Checks skipped · PR is already up-to-date
  • Merged2026-06-17 23:59 UTC · at f08c3a36be91ef6e7ec0b6295bbf218f2720a25b · squash

This pull request spent 9 seconds in the queue, including 1 second running CI.

Required conditions to merge

@mergify
mergify Bot merged commit a5f478e into box:master Jun 17, 2026
9 of 10 checks passed
@mergify mergify Bot removed the queued label Jun 17, 2026
kduncanhsu pushed a commit to kduncanhsu/box-ui-elements that referenced this pull request Jun 18, 2026
…omment (box#4638)

Video comments encode the frame timestamp inline as a
#[timestamp:NNN,versionId:NNN] markup prefix on the comment message.
The transformer strips that prefix for display, but the editor only
contains the visible text, so editing the comment dropped the markup
from the payload and the badge was lost.

Capture the original markup token in extractTimestampMarkup, store it
on TransformedCommentItem, and re-prepend it to the serialized text
when the root comment is edited. Replies and non-timestamped comments
are unchanged.

Co-authored-by: Jackie Jou <jackiejou@users.noreply.github.com>
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.

3 participants