Fix two tiny issues with autocompletion logging - Do not report COMMENT_COMPLETION_SAVE_DRAFT, if no hint was accepted - Add `hasDraftChanged` to COMMENT_COMPLETION_SUGGESTION_FETCHED Release-Notes: skip Change-Id: Ib20f37f33f07da4bde4e7951171c9f7e9a3ee3a8
diff --git a/polygerrit-ui/app/elements/shared/gr-comment/gr-comment.ts b/polygerrit-ui/app/elements/shared/gr-comment/gr-comment.ts index f9bfbde..cc2d6bd 100644 --- a/polygerrit-ui/app/elements/shared/gr-comment/gr-comment.ts +++ b/polygerrit-ui/app/elements/shared/gr-comment/gr-comment.ts
@@ -941,6 +941,7 @@ } private reportHintInteractionSaved() { + if (this.autocompleteAcceptedHints.length === 0) return; const content = this.messageText.trimEnd(); const acceptedHintsConcatenated = this.autocompleteAcceptedHints.join(''); const numExtraCharacters = @@ -1440,7 +1441,7 @@ ); this.reportHintInteraction( Interaction.COMMENT_COMPLETION_SUGGESTION_FETCHED, - context + {...context, hasDraftChanged: this.messageText !== commentText} ); if (!response?.completion) return; // Note that we are setting the cache value for `commentText` and getting the value
diff --git a/polygerrit-ui/app/utils/autocomplete-cache.ts b/polygerrit-ui/app/utils/autocomplete-cache.ts index c8077ab..b1dba44 100644 --- a/polygerrit-ui/app/utils/autocomplete-cache.ts +++ b/polygerrit-ui/app/utils/autocomplete-cache.ts
@@ -24,6 +24,8 @@ acceptedSuggestionsCount?: number; totalAcceptedCharacters?: number; savedDraftLength?: number; + + hasDraftChanged?: boolean; } /**