From 2d81e54f1425eb381ccf03b169638a2a007b5004 Mon Sep 17 00:00:00 2001 From: Timur Ismagilov Date: Tue, 17 May 2022 16:43:03 +0300 Subject: [PATCH] About: Show the registration limit --- views/about.go | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/views/about.go b/views/about.go index f0ad2dd..a93cbdd 100644 --- a/views/about.go +++ b/views/about.go @@ -47,6 +47,10 @@ const aboutTemplateString = `
{{ get .L.UserCount }}
{{ .UserCount }}
+ {{if .Cfg.RegistrationLimit}} +
{{get .L.RegistrationLimit}}
+
{{.RegistrationLimit}}
+ {{end}}
{{ get .L.Admins }}
{{$cfg := .Cfg}}{{ range $i, $username := .Admins }} @@ -62,17 +66,19 @@ const aboutTemplateString = ` ` var aboutData = struct { - L map[string]l10nEntry - Cfg map[string]interface{} - Admins []string - UserCount uint64 + L map[string]l10nEntry + Cfg map[string]interface{} + Admins []string + UserCount uint64 + RegistrationLimit uint64 }{ L: map[string]l10nEntry{ - "Title": en("About %s").ru("О %s"), - "Version": en("Mycorrhiza Wiki version").ru("Версия Микоризы"), - "UserCount": en("User count").ru("Число пользователей"), - "HomeHypha": en("Home hypha").ru("Домашняя гифа"), - "Admins": en("Administrators").ru("Администраторы"), + "Title": en("About %s").ru("О %s"), + "Version": en("Mycorrhiza Wiki version").ru("Версия Микоризы"), + "UserCount": en("User count").ru("Число пользователей"), + "HomeHypha": en("Home hypha").ru("Домашняя гифа"), + "RegistrationLimit": en("RegistrationLimit").ru("Максимум пользователей"), + "Admins": en("Administrators").ru("Администраторы"), "Auth": en("Authentication").ru("Аутентификация"), "AuthOn": en("Authentication is on").ru("Аутентификация включена"), @@ -92,11 +98,13 @@ func AboutHTML(lc *l18n.Localizer) string { data := aboutData data.Admins = user.ListUsersWithGroup("admin") data.UserCount = user.Count() + data.RegistrationLimit = cfg.RegistrationLimit data.Cfg = map[string]interface{}{ - "UseAuth": cfg.UseAuth, - "WikiName": cfg.WikiName, - "HomeHypha": cfg.HomeHypha, - "TelegramEnabled": cfg.TelegramEnabled, + "UseAuth": cfg.UseAuth, + "WikiName": cfg.WikiName, + "HomeHypha": cfg.HomeHypha, + "TelegramEnabled": cfg.TelegramEnabled, + "RegistrationLimit": cfg.RegistrationLimit, } var out strings.Builder err = temp.Execute(&out, data)