Skip to content

Commit f8771d5

Browse files
committed
Apply suggestions from code review
1 parent c2c675e commit f8771d5

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

routers/web/repo/recent_commits.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ func RecentCommits(ctx *context.Context) {
2222

2323
ctx.Data["PageIsActivity"] = true
2424
ctx.Data["PageIsRecentCommits"] = true
25-
ctx.PageData["repoLink"] = ctx.Repo.RepoLink
2625

2726
ctx.HTML(http.StatusOK, tplRecentCommits)
2827
}

templates/repo/recent_commits.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
data-locale-loading-title-failed="{{ctx.Locale.Tr "graphs.component_loading_failed" (ctx.Locale.Tr "graphs.recent_commits.what")}}"
55
data-locale-loading-info="{{ctx.Locale.Tr "graphs.component_loading_info"}}"
66
data-locale-component-failed-to-load="{{ctx.Locale.Tr "graphs.component_failed_to_load"}}"
7+
data-repo-link="{{ctx.Repo.RepoLink}}"
78
>
89
</div>
910
{{end}}

web_src/js/components/RepoRecentCommits.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ import {chartJsColors} from '../utils/color.js';
1818
import {sleep} from '../utils.js';
1919
import 'chartjs-adapter-dayjs-4/dist/chartjs-adapter-dayjs-4.esm';
2020
21-
const {pageData} = window.config;
22-
2321
Chart.defaults.color = chartJsColors.text;
2422
Chart.defaults.borderColor = chartJsColors.border;
2523
@@ -37,11 +35,14 @@ export default {
3735
type: Object,
3836
required: true
3937
},
38+
repoLink: {
39+
type: String,
40+
required: true
41+
}
4042
},
4143
data: () => ({
4244
isLoading: false,
4345
errorText: '',
44-
repoLink: pageData.repoLink || [],
4546
data: [],
4647
}),
4748
mounted() {
@@ -53,7 +54,7 @@ export default {
5354
try {
5455
let response;
5556
do {
56-
response = await GET(`${this.repoLink}/activity/recent-commits/data`);
57+
response = await GET(`${repoLink}/activity/recent-commits/data`);
5758
if (response.status === 202) {
5859
await sleep(1000); // wait for 1 second before retrying
5960
}

web_src/js/features/recent-commits.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ export async function initRepoRecentCommits() {
1111
loadingTitle: el.getAttribute('data-locale-loading-title'),
1212
loadingTitleFailed: el.getAttribute('data-locale-loading-title-failed'),
1313
loadingInfo: el.getAttribute('data-locale-loading-info'),
14-
}
14+
},
15+
repoLink: el.getAttribute('data-repo-link')
1516
});
1617
View.mount(el);
1718
} catch (err) {

0 commit comments

Comments
 (0)