Skip to content

Commit 62b4784

Browse files
committed
rename defaultSelectedBranch
1 parent 0573139 commit 62b4784

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

templates/repo/branch_dropdown.tmpl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
* ContainerClasses
44
* (TODO: search "branch_dropdown" in the template direcotry)
55
*/}}
6-
{{$defaultSelectedBranch := $.root.BranchName}}
6+
{{$defaultSelectedRefName := $.root.BranchName}}
77
{{if and .root.IsViewTag (not .noTag)}}
8-
{{$defaultSelectedBranch = .root.TagName}}
8+
{{$defaultSelectedRefName = .root.TagName}}
99
{{end}}
10-
{{if eq $defaultSelectedBranch ""}}
11-
{{$defaultSelectedBranch = $.root.Repository.defaultSelectedBranch}}
10+
{{if eq $defaultSelectedRefName ""}}
11+
{{$defaultSelectedRefName = $.root.Repository.DefaultBranch}}
1212
{{end}}
1313

1414
{{$type := ""}}
@@ -45,7 +45,7 @@
4545
'tagName': {{.root.TagName}},
4646
'branchName': {{.root.BranchName}},
4747
'noTag': {{.noTag}},
48-
'defaultSelectedBranch': {{$defaultSelectedBranch}},
48+
'defaultSelectedRefName': {{$defaultSelectedRefName}},
4949
'repoDefaultBranch': {{.root.Repository.DefaultBranch}},
5050
'enableFeed': {{.root.EnableFeed}},
5151
'rssURLPrefix': '{{$.root.RepoLink}}/rss/branch/',

web_src/js/components/RepoBranchTagSelector.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,16 +190,15 @@ const sfc = {
190190
}
191191
this.isLoading = true;
192192
try {
193-
// the "data.defaultSelectedBranch" is ambiguous, it could be "branch name" or "tag name"
194193
const reqUrl = `${this.repoLink}/${this.mode}/list`;
195194
const resp = await fetch(reqUrl);
196195
const {results} = await resp.json();
197196
for (const result of results) {
198197
let selected = false;
199198
if (this.mode === 'branches') {
200-
selected = result === this.defaultSelectedBranch;
199+
selected = result === this.defaultSelectedRefName;
201200
} else {
202-
selected = result === (this.release ? this.release.tagName : this.defaultSelectedBranch);
201+
selected = result === (this.release ? this.release.tagName : this.defaultSelectedRefName);
203202
}
204203
this.items.push({name: result, url: pathEscapeSegments(result), branch: this.mode === 'branches', tag: this.mode === 'tags', selected});
205204
}

0 commit comments

Comments
 (0)