Skip to content

Conversation

@bfoxx1906
Copy link
Contributor

@bfoxx1906 bfoxx1906 commented Dec 1, 2025

Video Annotations do not currently include the version number link like annotations do for other file types. This PR updates the logic to include the version link if there are versions and the annotation is a video annotations that does not belong to the current version. The logic change can be seen here. Unit tests were also updated to verify the conditional and also update one of the existing tests to make it more comprehensive(Pr Ref)

Video Annotations Before:
Screenshot 2025-12-01 at 2 19 24 PM

Video Annotations After:

Screenshot 2025-12-01 at 5 28 19 PM

Current Non Video Annotations Functionality Unchanged:

Screenshot 2025-12-01 at 5 29 29 PM

Summary by CodeRabbit

  • Bug Fixes
    • Improved annotation activity link visibility for video annotations. Links now display for previous versions while remaining hidden for the current version, enabling better navigation between annotation states.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 1, 2025

Walkthrough

The rendering condition for the AnnotationActivityLink in video annotations was refined. The link now displays when hasVersions is true and either the annotation is not a video type or it is a video annotation that is not the current version. Corresponding test cases were renamed and expanded to validate this behavior.

Changes

Cohort / File(s) Summary
Annotation Activity Component
src/elements/content-sidebar/activity-feed/annotations/AnnotationActivity.js
Modified the rendering condition for AnnotationActivityLink to display for video annotations when they are not the current version, while maintaining display for all non-video annotations with versions.
Annotation Activity Tests
src/elements/content-sidebar/activity-feed/annotations/__tests__/AnnotationActivity.test.js
Renamed existing test to clarify current-version requirement; added test for non-current video annotation versions; added assertion for page annotation link messaging.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Straightforward conditional logic modification with clear intent
  • Test changes are consistent and follow predictable patterns
  • Limited scope affecting only rendering behavior

Possibly related PRs

Suggested labels

ready-to-merge

Suggested reviewers

  • jfox-box
  • jmcbgaston
  • JChan106

Poem

🐰 A link that hides for latest frames,
But shows when past versions claim their names!
Video annotations dance with care,
Version states now handled fair.
Hop hop — logic's cleaner, tests declare! ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the main change: adding version links for video annotations, which aligns with the changeset modifications to AnnotationActivity component and tests.
Description check ✅ Passed The description is comprehensive and well-structured, explaining the problem, solution, code changes, test updates, and includes before/after screenshots demonstrating the fix functionality.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

@bfoxx1906 bfoxx1906 changed the title fix(video-annotations): Add version links for video annotation activi… fix(video-annotations): Add version links for video annotations Dec 1, 2025
@bfoxx1906 bfoxx1906 marked this pull request as ready for review December 1, 2025 22:32
@bfoxx1906 bfoxx1906 requested review from a team as code owners December 1, 2025 22:32
Copy link
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: 0

🧹 Nitpick comments (2)
src/elements/content-sidebar/activity-feed/annotations/AnnotationActivity.js (1)

167-176: Version-link visibility logic correctly extended for video annotations

The new condition matches the intended behavior: non-video annotations still show the link whenever hasVersions is true, and video annotations now show it only when hasVersions is true and the annotation is not the current version. This is behaviorally consistent with the existing linkMessage/linkValue logic.

If you want to slightly simplify the expression, you could use the equivalent form that directly encodes the “all versions except current video” rule:

-            <ActivityTimestamp date={createdAtTimestamp} />
-            {hasVersions && ((isVideoAnnotation && !isCurrentVersion) || !isVideoAnnotation) && (
+            <ActivityTimestamp date={createdAtTimestamp} />
+            {hasVersions && !(isVideoAnnotation && isCurrentVersion) && (
                 <AnnotationActivityLink
                     className="bcs-AnnotationActivity-link"
                     data-resin-target="annotationLink"
                     id={id}
                     isDisabled={isFileVersionUnavailable}
                     message={activityLinkMessage}
                     onClick={handleSelect}
                 />
             )}
src/elements/content-sidebar/activity-feed/annotations/__tests__/AnnotationActivity.test.js (1)

389-397: Video-annotation tests accurately cover current vs non-current version behavior

These two tests nicely pin down the new behavior for video annotations:

  • isCurrentVersion: true + hasVersions: true → no AnnotationActivityLink.
  • isCurrentVersion: false + hasVersions: trueAnnotationActivityLink present with the expected annotationActivityVersionLink message and version '2'.

That gives good confidence the new conditional in AnnotationActivity won’t regress.

Tiny optional nit: the first test name reads “Link link”; you could clean that up if you touch this again:

-test('should not show Annotation Activity Link link for video annotations when is current version and hasVersions is true', () => {
+test('should not show Annotation Activity Link for video annotations when is current version and hasVersions is true', () => {

Also applies to: 399-412

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 671a067 and b5669de.

📒 Files selected for processing (2)
  • src/elements/content-sidebar/activity-feed/annotations/AnnotationActivity.js (1 hunks)
  • src/elements/content-sidebar/activity-feed/annotations/__tests__/AnnotationActivity.test.js (3 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-19T17:50:47.187Z
Learnt from: bfoxx1906
Repo: box/box-ui-elements PR: 4228
File: src/elements/content-sidebar/activity-feed/comment/Comment.js:147-148
Timestamp: 2025-08-19T17:50:47.187Z
Learning: In the box-ui-elements codebase, ActivityThreadReplyForm.js and AnnotationThreadCreate.js component files exist but are not actively used/imported anywhere, so they don't need updates for prop propagation.

Applied to files:

  • src/elements/content-sidebar/activity-feed/annotations/__tests__/AnnotationActivity.test.js
🧬 Code graph analysis (1)
src/elements/content-sidebar/activity-feed/annotations/__tests__/AnnotationActivity.test.js (1)
src/elements/content-sidebar/activity-feed/annotations/messages.js (1)
  • messages (3-50)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: lint_test_build
  • GitHub Check: Summary
🔇 Additional comments (1)
src/elements/content-sidebar/activity-feed/annotations/__tests__/AnnotationActivity.test.js (1)

478-481: Additional assertion for non-video link message guards against regressions

The new expectation that AnnotationActivityLink uses annotationActivityPageItem with { number: 1 } for non-video annotations ensures the page-style text isn’t accidentally changed by the video/version logic. This complements the other tests well and keeps non-video behavior explicitly covered.

Copy link
Contributor

@jfox-box jfox-box left a comment

Choose a reason for hiding this comment

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

LGTM but one request

@mergify
Copy link
Contributor

mergify bot commented Dec 3, 2025

Merge Queue Status Beta

✅ The pull request has been merged

This pull request spent 10 seconds in the queue, with no time running CI.
The checks were run in-place.

Required conditions to merge

@mergify mergify bot added the queued label Dec 3, 2025
@mergify mergify bot merged commit 8bf7c63 into box:master Dec 3, 2025
6 of 7 checks passed
@mergify mergify bot removed the queued label Dec 3, 2025
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