Skip to content

Commit 3580286

Browse files
committed
Clean up code to address review comments
1 parent 4e74e74 commit 3580286

File tree

2 files changed

+2
-14
lines changed

2 files changed

+2
-14
lines changed

routers/web/repo/treelist.go

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ type FileDiffFile struct {
5959
Name string
6060
NameHash string
6161
IsSubmodule bool
62-
IsBinary bool
6362
IsViewed bool
6463
Status string
6564
}
@@ -72,18 +71,12 @@ func transformDiffTreeForUI(diffTree *gitdiff.DiffTree, filesViewedState map[str
7271
for _, file := range diffTree.Files {
7372
nameHash := git.HashFilePathForWebUI(file.HeadPath)
7473
isSubmodule := file.HeadMode == git.EntryModeCommit
75-
isBinary := file.HeadMode == git.EntryModeExec
76-
77-
isViewed := false
78-
if fileViewedState, ok := filesViewedState[file.Path()]; ok {
79-
isViewed = (fileViewedState == pull_model.Viewed)
80-
}
74+
isViewed := filesViewedState[file.Path()] == pull_model.Viewed
8175

8276
files = append(files, FileDiffFile{
8377
Name: file.HeadPath,
8478
NameHash: nameHash,
8579
IsSubmodule: isSubmodule,
86-
IsBinary: isBinary,
8780
IsViewed: isViewed,
8881
Status: file.Status,
8982
})

templates/repo/diff/box.tmpl

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,13 @@
6060
<script id="diff-data-script" type="module">
6161
const diffDataFiles = [{{range $i, $file := .DiffFiles}}
6262
{Name:"{{$file.Name}}",NameHash:"{{$file.NameHash}}",Status:{{$file.Status}},IsSubmodule:{{$file.IsSubmodule}},IsViewed:{{$file.IsViewed}}},{{end}}];
63+
6364
const diffData = {
6465
isIncomplete: {{.Diff.IsIncomplete}},
65-
tooManyFilesMessage: "{{ctx.Locale.Tr "repo.diff.too_many_files"}}",
66-
binaryFileMessage: "{{ctx.Locale.Tr "repo.diff.bin"}}",
67-
showMoreMessage: "{{ctx.Locale.Tr "repo.diff.show_more"}}",
68-
statisticsMessage: "{{ctx.Locale.Tr "repo.diff.stats_desc_file"}}",
69-
linkLoadMore: "?skip-to={{.Diff.End}}&file-only=true",
7066
};
7167
7268
// for first time loading, the diffFileInfo is a plain object
7369
// after the Vue component is mounted, the diffFileInfo is a reactive object
74-
// keep in mind that this script block would be executed many times when loading more files, by "loadMoreFiles"
7570
let diffFileInfo = window.config.pageData.diffFileInfo || {
7671
files:[],
7772
fileTreeIsVisible: false,

0 commit comments

Comments
 (0)