Skip to content

Commit 27ee1a2

Browse files
committed
fix
1 parent 5d9bf83 commit 27ee1a2

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

routers/web/repo/contributors.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ func Contributors(ctx *context.Context) {
2121
ctx.Data["Title"] = ctx.Tr("repo.activity.navbar.contributors")
2222
ctx.Data["PageIsActivity"] = true
2323
ctx.Data["PageIsContributors"] = true
24-
ctx.PageData["repoContributorsData"] = map[string]any{
25-
"repoDefaultBranch": ctx.Repo.RefName,
26-
}
2724
ctx.HTML(http.StatusOK, tplContributors)
2825
}
2926

templates/repo/contributors.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{{if .Permission.CanRead ctx.Consts.RepoUnitTypeCode}}
22
<div id="repo-contributors-chart"
33
data-repo-link="{{.RepoLink}}"
4+
data-repo-default-branch-name="{{.Repository.DefaultBranch}}"
45
data-locale-filter-label="{{ctx.Locale.Tr "repo.contributors.contribution_type.filter_label"}}"
56
data-locale-contribution-type-commits="{{ctx.Locale.Tr "repo.contributors.contribution_type.commits"}}"
67
data-locale-contribution-type-additions="{{ctx.Locale.Tr "repo.contributors.contribution_type.additions"}}"

web_src/js/components/RepoContributors.vue

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ import {sleep} from '../utils.ts';
2727
import 'chartjs-adapter-dayjs-4/dist/chartjs-adapter-dayjs-4.esm';
2828
import {fomanticQuery} from '../modules/fomantic/base.ts';
2929
import type {Entries} from 'type-fest';
30-
31-
const {pageData} = window.config;
30+
import {pathEscapeSegments} from '../utils/url.ts';
3231
3332
const customEventListener: Plugin = {
3433
id: 'customEventListener',
@@ -68,14 +67,17 @@ export default {
6867
type: String,
6968
required: true,
7069
},
70+
repoDefaultBranchName: {
71+
type: String,
72+
required: true,
73+
},
7174
},
7275
data: () => ({
7376
isLoading: false,
7477
errorText: '',
7578
totalStats: {} as Record<string, any>,
7679
sortedContributors: {} as Record<string, any>,
7780
type: 'commits',
78-
repoBranch: pageData.repoContributorsData.repoDefaultBranch,
7981
contributorsStats: {} as Record<string, any>,
8082
xAxisStart: null,
8183
xAxisEnd: null,
@@ -110,7 +112,7 @@ export default {
110112
const params = new URLSearchParams({
111113
'q': `after:${min}, before:${max}, author:${contributorEmail}`,
112114
});
113-
return `${this.repoLink}/commits/branch/${this.repoBranch}/search?${params.toString()}`;
115+
return `${this.repoLink}/commits/branch/${pathEscapeSegments(this.repoDefaultBranchName)}/search?${params.toString()}`;
114116
},
115117
116118
async fetchGraphData() {
@@ -228,7 +230,7 @@ export default {
228230
};
229231
},
230232
231-
updateOtherCharts({chart}: {chart: Chart}, reset?: boolean = false) {
233+
updateOtherCharts({chart}: {chart: Chart}, reset: boolean = false) {
232234
const minVal = chart.options.scales.x.min;
233235
const maxVal = chart.options.scales.x.max;
234236
if (reset) {
@@ -394,7 +396,7 @@ export default {
394396
<div class="ui top attached header tw-flex tw-flex-1">
395397
<b class="ui right">#{{ index + 1 }}</b>
396398
<a :href="contributor.home_link">
397-
<img class="ui avatar tw-align-middle" height="40" width="40" :src="contributor.avatar_link">
399+
<img class="ui avatar tw-align-middle" height="40" width="40" :src="contributor.avatar_link" alt="{{ contributor.name }}">
398400
</a>
399401
<div class="tw-ml-2">
400402
<a v-if="contributor.home_link !== ''" :href="contributor.home_link"><h4>{{ contributor.name }}</h4></a>

web_src/js/features/contributors.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export async function initRepoContributors() {
88
try {
99
const View = createApp(RepoContributors, {
1010
repoLink: el.getAttribute('data-repo-link'),
11+
repoDefaultBranchName: el.getAttribute('data-repo-default-branch-name'),
1112
locale: {
1213
filterLabel: el.getAttribute('data-locale-filter-label'),
1314
contributionType: {

0 commit comments

Comments
 (0)