summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/batch_comments/components/preview_item.vue
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/batch_comments/components/preview_item.vue')
-rw-r--r--app/assets/javascripts/batch_comments/components/preview_item.vue15
1 files changed, 8 insertions, 7 deletions
diff --git a/app/assets/javascripts/batch_comments/components/preview_item.vue b/app/assets/javascripts/batch_comments/components/preview_item.vue
index 22495eb4d7d..3162a83f099 100644
--- a/app/assets/javascripts/batch_comments/components/preview_item.vue
+++ b/app/assets/javascripts/batch_comments/components/preview_item.vue
@@ -52,14 +52,12 @@ export default {
});
},
linePosition() {
- if (this.draft.position && this.draft.position.position_type === IMAGE_DIFF_POSITION_TYPE) {
+ if (this.position?.position_type === IMAGE_DIFF_POSITION_TYPE) {
// eslint-disable-next-line @gitlab/require-i18n-strings
- return `${this.draft.position.x}x ${this.draft.position.y}y`;
+ return `${this.position.x}x ${this.position.y}y`;
}
- const position = this.discussion ? this.discussion.position : this.draft.position;
-
- return position?.new_line || position?.old_line;
+ return this.position?.new_line || this.position?.old_line;
},
content() {
const el = document.createElement('div');
@@ -70,11 +68,14 @@ export default {
showLinePosition() {
return this.draft.file_hash || this.isDiffDiscussion;
},
+ position() {
+ return this.draft.position || this.discussion.position;
+ },
startLineNumber() {
- return getStartLineNumber(this.draft.position?.line_range);
+ return getStartLineNumber(this.position?.line_range);
},
endLineNumber() {
- return getEndLineNumber(this.draft.position?.line_range);
+ return getEndLineNumber(this.position?.line_range);
},
},
methods: {