Skip to content

Commit e59800b

Browse files
chore: fix lint issues
chore: removed unwanted code
1 parent 914bed8 commit e59800b

File tree

4 files changed

+0
-17
lines changed

4 files changed

+0
-17
lines changed

routers/web/repo/compare.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -958,13 +958,11 @@ func ExcerptBlob(ctx *context.Context) {
958958
section.Lines = append(section.Lines, lineSection)
959959
}
960960
}
961-
962961
for _, line := range section.Lines {
963962
if line.SectionInfo != nil {
964963
//for now considerign only right side.
965964
start := int64(line.SectionInfo.LastRightIdx + 1)
966965
end := int64(line.SectionInfo.RightIdx - 1)
967-
968966
//to check section has comments or not.
969967
//1. we can use binary search
970968
//2. we can LastRightCommentIdx, RightCommentIdx, LastLeftCommentIdx, LeftCommentIdx(little complex but fast)
@@ -977,11 +975,9 @@ func ExcerptBlob(ctx *context.Context) {
977975
line.SectionInfo.HasComments = true
978976
break
979977
}
980-
981978
}
982979
start += 1
983980
}
984-
985981
}
986982
if comments, ok := lineCommits[int64(line.LeftIdx*-1)]; ok {
987983
line.Comments = append(line.Comments, comments...)
@@ -994,7 +990,6 @@ func ExcerptBlob(ctx *context.Context) {
994990
return line.Comments[i].CreatedUnix < line.Comments[j].CreatedUnix
995991
})
996992
}
997-
998993
for _, line := range section.Lines {
999994
for _, comment := range line.Comments {
1000995
if err := comment.LoadAttachments(ctx); err != nil {
@@ -1003,7 +998,6 @@ func ExcerptBlob(ctx *context.Context) {
1003998
}
1004999
}
10051000
}
1006-
10071001
ctx.Data["section"] = section
10081002
ctx.Data["FileNameHash"] = git.HashFilePathForWebUI(filePath)
10091003
ctx.Data["AfterCommitID"] = commitID
@@ -1014,7 +1008,6 @@ func ExcerptBlob(ctx *context.Context) {
10141008
ctx.Data["CanBlockUser"] = func(blocker, blockee *user_model.User) bool {
10151009
return user_service.CanBlockUser(ctx, ctx.Doer, blocker, blockee)
10161010
}
1017-
10181011
if ctx.Data["SignedUserID"] == nil {
10191012
ctx.Data["SignedUserID"] = ctx.Doer.ID
10201013
}

services/gitdiff/gitdiff.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -485,20 +485,16 @@ func (diff *Diff) LoadComments(ctx context.Context, issue *issues_model.Issue, c
485485
if line.SectionInfo != nil {
486486
start := int64(line.SectionInfo.LastRightIdx + 1)
487487
end := int64(line.SectionInfo.RightIdx - 1)
488-
489488
for start <= end {
490489
if _, ok := lineCommits[start]; ok {
491490
if line.SectionInfo.LastRightCommentIdx == 0 {
492491
// line.SectionInfo.LastRightCommentIdx = int(start)
493492
// line.SectionInfo.RightCommentIdx = int(start)
494493
line.SectionInfo.HasComments = true
495-
496494
break
497495
}
498-
499496
}
500497
start += 1
501-
502498
}
503499
}
504500
if comments, ok := lineCommits[int64(line.LeftIdx*-1)]; ok {

templates/repo/diff/blob_excerpt.tmpl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,19 +91,16 @@
9191
<button class="code-expander-button" hx-target="closest tr" hx-get="{{$.RepoLink}}/blob_excerpt/{{PathEscape $.AfterCommitID}}?{{$line.GetBlobExcerptQuery}}&style=unified&direction=down&wiki={{$.PageIsWiki}}&pull={{$.PageIsPullFiles}}&anchor={{$.Anchor}}&file_name={{$.section.FileName}}">
9292
{{svg "octicon-fold-down"}}
9393
</button>
94-
test else down blob {{$line.SectionInfo.HasComments}}
9594
{{end}}
9695
{{if or (eq $expandDirection 3) (eq $expandDirection 4)}}
9796
<button class="code-expander-button" hx-target="closest tr" hx-get="{{$.RepoLink}}/blob_excerpt/{{PathEscape $.AfterCommitID}}?{{$line.GetBlobExcerptQuery}}&style=unified&direction=up&wiki={{$.PageIsWiki}}&pull={{$.PageIsPullFiles}}&anchor={{$.Anchor}}&file_name={{$.section.FileName}}">
9897
{{svg "octicon-fold-up"}}
9998
</button>
100-
test else up blob
10199
{{end}}
102100
{{if eq $expandDirection 2}}
103101
<button class="code-expander-button" hx-target="closest tr" hx-get="{{$.RepoLink}}/blob_excerpt/{{PathEscape $.AfterCommitID}}?{{$line.GetBlobExcerptQuery}}&style=unified&direction=&wiki={{$.PageIsWiki}}&pull={{$.PageIsPullFiles}}&anchor={{$.Anchor}}&file_name={{$.section.FileName}}">
104102
{{svg "octicon-fold"}}
105103
</button>
106-
test else both blob
107104
{{end}}
108105
</div>
109106
</div>

templates/repo/diff/section_unified.tmpl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,16 @@
2727
<button class="code-expander-button" hx-target="closest tr" hx-get="{{$blobExcerptRepoLink}}/blob_excerpt/{{PathEscape $.root.AfterCommitID}}?{{$line.GetBlobExcerptQuery}}&style=unified&direction=down&wiki={{$.root.PageIsWiki}}&pull={{$.root.PageIsPullFiles}}&anchor=diff-{{$file.NameHash}}K{{$line.SectionInfo.RightIdx}}&file_name={{$section.FileName}}">
2828
{{svg "octicon-fold-down"}}
2929
</button>
30-
test down
3130
{{end}}
3231
{{if or (eq $expandDirection 3) (eq $expandDirection 4)}}
3332
<button class="code-expander-button" hx-target="closest tr" hx-get="{{$blobExcerptRepoLink}}/blob_excerpt/{{PathEscape $.root.AfterCommitID}}?{{$line.GetBlobExcerptQuery}}&style=unified&direction=up&wiki={{$.root.PageIsWiki}}&pull={{$.root.PageIsPullFiles}}&anchor=diff-{{$file.NameHash}}K{{$line.SectionInfo.RightIdx}}&file_name={{$section.FileName}}">
3433
{{svg "octicon-fold-up"}}
3534
</button>
36-
test up
3735
{{end}}
3836
{{if eq $expandDirection 2}}
3937
<button class="code-expander-button" hx-target="closest tr" hx-get="{{$blobExcerptRepoLink}}/blob_excerpt/{{PathEscape $.root.AfterCommitID}}?{{$line.GetBlobExcerptQuery}}&style=unified&direction=&wiki={{$.root.PageIsWiki}}&pull={{$.root.PageIsPullFiles}}&anchor=diff-{{$file.NameHash}}K{{$line.SectionInfo.RightIdx}}&file_name={{$section.FileName}}">
4038
{{svg "octicon-fold"}}
4139
</button>
42-
test fold
4340
{{end}}
4441
</div>
4542
</div>

0 commit comments

Comments
 (0)