diff options
context:
space:
mode:
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Fold `enable-stats` back into `max-stats`
A `max-stats` period enables the page again, as it did before v2.2.0, so one key does both jobs.
Diffstat (limited to 'source/ui-stats.c')
-rw-r--r--source/ui-stats.c7
1 file changed, 3 insertions, 4 deletions
diff --git a/source/ui-stats.c b/source/ui-stats.c
index 134e4c2..97918e0 100644
--- a/source/ui-stats.c
+++ b/source/ui-stats.c
@@ -382,9 +382,8 @@ static void print_options_form(const struct cgit_period *period, int top)
html("<form method='get'>");
cgit_add_hidden_formfields(1, 0, "stats");
html("<table><tr><td colspan='2'></td></tr>\n");
- if (!ctx.repo->max_stats || ctx.repo->max_stats > 1) {
- choices = ctx.repo->max_stats ?
- ctx.repo->max_stats : (int)ARRAY_SIZE(periods);
+ if (ctx.repo->max_stats > 1) {
+ choices = ctx.repo->max_stats;
html("<tr><td class='label'>Period:</td>");
html("<td class='ctrl'><select name='period' data-autosubmit='1'>");
for (i = 0; i < choices; i++)
@@ -452,7 +451,7 @@ void cgit_show_stats(void)
"Unknown statistics type: %c", code[0]);
return;
}
- if (ctx.repo->max_stats && period_index > ctx.repo->max_stats) {
+ if (period_index > ctx.repo->max_stats) {
cgit_print_error_page(400, "Bad Request",
"Statistics type disabled: %s", period->name);
return;