Merge "Fix related-change-click metric for cherry-picks"
diff --git a/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-changes-list.ts b/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-changes-list.ts
index b4b6d31..5705c4f 100644
--- a/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-changes-list.ts
+++ b/polygerrit-ui/app/elements/change/gr-related-changes-list/gr-related-changes-list.ts
@@ -451,12 +451,14 @@
?.getElementsByClassName('arrowToCurrentChange')[0]
?.nextElementSibling?.nextElementSibling?.getElementsByTagName('a')[0];
- if (!target || !currentChange) return;
+ if (!target) return;
this.reportingService.reportInteraction('related-change-click', {
sectionName,
index: sectionLinks.indexOf(target) + 1,
countChanges: sectionLinks.length,
- currentChangeIndex: sectionLinks.indexOf(currentChange) + 1,
+ currentChangeIndex: !currentChange
+ ? undefined
+ : sectionLinks.indexOf(currentChange) + 1,
});
}
}