diff --git a/polygerrit-ui/app/elements/diff/gr-patch-range-select/gr-patch-range-select.js b/polygerrit-ui/app/elements/diff/gr-patch-range-select/gr-patch-range-select.js index 3bf369709b..c00c0fb798 100644 --- a/polygerrit-ui/app/elements/diff/gr-patch-range-select/gr-patch-range-select.js +++ b/polygerrit-ui/app/elements/diff/gr-patch-range-select/gr-patch-range-select.js @@ -25,6 +25,7 @@ import {PolymerElement} from '@polymer/polymer/polymer-element.js'; import {htmlTemplate} from './gr-patch-range-select_html.js'; import {PatchSetBehavior} from '../../../behaviors/gr-patch-set-behavior/gr-patch-set-behavior.js'; import {GrCountStringFormatter} from '../../shared/gr-count-string-formatter/gr-count-string-formatter.js'; +import {appContext} from '../../../services/app-context.js'; // Maximum length for patch set descriptions. const PATCH_DESC_MAX_LENGTH = 500; @@ -78,6 +79,11 @@ class GrPatchRangeSelect extends mixinBehaviors( [ ]; } + constructor() { + super(); + this.reporting = appContext.reportingService; + } + _getShaForPatch(patch) { return patch.sha.substring(0, 10); } @@ -285,8 +291,14 @@ class GrPatchRangeSelect extends mixinBehaviors( [ const target = dom(e).localTarget; if (target === this.$.patchNumDropdown) { + if (detail.patchNum === e.detail.value) return; + this.reporting.reportInteraction('right-patchset-changed', + {previous: detail.patchNum, current: e.detail.value}); detail.patchNum = e.detail.value; } else { + if (detail.basePatchNum === e.detail.value) return; + this.reporting.reportInteraction('left-patchset-changed', + {previous: detail.basePatchNum, current: e.detail.value}); detail.basePatchNum = e.detail.value; }