Skip to content

Commit 8bf7c63

Browse files
authored
fix(video-annotations): Add version links for video annotations (#4379)
fix(video-annotations): Add version links for video annotation activities
1 parent 60eda40 commit 8bf7c63

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

src/elements/content-sidebar/activity-feed/annotations/AnnotationActivity.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ const AnnotationActivity = ({
164164
</div>
165165
<div className="bcs-AnnotationActivity-timestamp">
166166
<ActivityTimestamp date={createdAtTimestamp} />
167-
{hasVersions && !isVideoAnnotation && (
167+
{hasVersions && ((isVideoAnnotation && !isCurrentVersion) || !isVideoAnnotation) && (
168168
<AnnotationActivityLink
169169
className="bcs-AnnotationActivity-link"
170170
data-resin-target="annotationLink"

src/elements/content-sidebar/activity-feed/annotations/__tests__/AnnotationActivity.test.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ describe('elements/content-sidebar/ActivityFeed/annotations/AnnotationActivity',
386386
expect(activityMessage.prop('annotationsMillisecondTimestamp')).toBe('0:01:00');
387387
});
388388

389-
test('should not show version link for video annotations even when hasVersions is true', () => {
389+
test('should not show Annotation Activity Link link for video annotations when is current version and hasVersions is true', () => {
390390
const wrapper = getWrapper({
391391
item: mockVideoAnnotation,
392392
hasVersions: true,
@@ -396,6 +396,21 @@ describe('elements/content-sidebar/ActivityFeed/annotations/AnnotationActivity',
396396
expect(wrapper.exists('AnnotationActivityLink')).toBe(false);
397397
});
398398

399+
test('should show Annotation Activity Link for video annotations when is not current version and hasVersions is true', () => {
400+
const wrapper = getWrapper({
401+
item: mockVideoAnnotation,
402+
hasVersions: true,
403+
isCurrentVersion: false,
404+
});
405+
406+
expect(wrapper.exists('AnnotationActivityLink')).toBe(true);
407+
408+
expect(wrapper.find('AnnotationActivityLink').prop('message')).toEqual({
409+
...messages.annotationActivityVersionLink,
410+
values: { number: '2' },
411+
});
412+
});
413+
399414
test('should pass correct timestamp format to ActivityMessage for video annotations', () => {
400415
const videoAnnotationWithTimestamp = {
401416
...mockVideoAnnotation,
@@ -460,6 +475,10 @@ describe('elements/content-sidebar/ActivityFeed/annotations/AnnotationActivity',
460475

461476
const wrapper = getWrapper({ item: regularAnnotation });
462477
const activityMessage = wrapper.find('ForwardRef(withFeatureConsumer(ActivityMessage))');
478+
expect(wrapper.find('AnnotationActivityLink').prop('message')).toEqual({
479+
...messages.annotationActivityPageItem,
480+
values: { number: 1 },
481+
});
463482

464483
expect(activityMessage.prop('annotationsMillisecondTimestamp')).toBeFalsy();
465484
});

0 commit comments

Comments
 (0)