Skip to content

Commit af864c2

Browse files
committed
fix assumption
1 parent c5c1c2b commit af864c2

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

services/gitdiff/gitdiff.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,8 @@ func FillHiddenCommentIDsForDiffLine(line *DiffLine, lineComments map[int64][]*i
224224
var hiddenCommentIDs []int64
225225
for commentLineNum, comments := range lineComments {
226226
if commentLineNum < 0 {
227-
continue // Skip left-side, unchanged lines always use "right (proposed)" side for comments
227+
// ATTENTION: BLOB-EXCERPT-COMMENT-RIGHT: skip left-side, unchanged lines always use "right (proposed)" side for comments
228+
continue
228229
}
229230
lineNum := int(commentLineNum)
230231
isEndOfFileExpansion := line.SectionInfo.RightHunkSize == 0

templates/repo/diff/blob_excerpt.tmpl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515
<td class="lines-escape lines-escape-old">{{if and $line.LeftIdx $inlineDiff.EscapeStatus.Escaped}}<button class="toggle-escape-button btn interact-bg" title="{{template "repo/diff/escape_title" dict "diff" $inlineDiff}}"></button>{{end}}</td>
1616
<td class="lines-type-marker lines-type-marker-old">{{if $line.LeftIdx}}<span class="tw-font-mono" data-type-marker=""></span>{{end}}</td>
1717
<td class="lines-code lines-code-old">
18-
{{- if and $canCreateComment $line.LeftIdx -}}
19-
<button type="button" aria-label="{{ctx.Locale.Tr "repo.diff.comment.add_line_comment"}}" class="ui primary button add-code-comment add-code-comment-left{{if (not $line.CanComment)}} tw-invisible{{end}}" data-side="left" data-idx="{{$line.LeftIdx}}">
18+
{{/* ATTENTION: BLOB-EXCERPT-COMMENT-RIGHT: here it intentially use "right" side to comment, because the backend code depends on the assumption that the comment only happens on right side*/}}
19+
{{- if and $canCreateComment $line.RightIdx -}}
20+
<button type="button" aria-label="{{ctx.Locale.Tr "repo.diff.comment.add_line_comment"}}" class="ui primary button add-code-comment add-code-comment-right{{if (not $line.CanComment)}} tw-invisible{{end}}" data-side="right" data-idx="{{$line.RightIdx}}">
2021
{{- svg "octicon-plus" -}}
2122
</button>
2223
{{- end -}}

0 commit comments

Comments
 (0)