diff --git a/cfg/config.go b/cfg/config.go index c13f00c..4267068 100644 --- a/cfg/config.go +++ b/cfg/config.go @@ -193,7 +193,7 @@ func ReadConfigFile(path string) error { TelegramEnabled = (TelegramBotToken != "") && (TelegramBotName != "") // This URL makes much more sense. If no URL is set or the protocol is forgotten, assume HTTP. - if (URL == "") || (strings.Index(URL, ":") == -1) { + if (URL == "") || !strings.Contains(URL, ":") { URL = "http://" + ListenAddr } diff --git a/history/revision.go b/history/revision.go index fd9293a..4817aa1 100644 --- a/history/revision.go +++ b/history/revision.go @@ -175,7 +175,7 @@ func (rev *Revision) hyphaeAffected() (hyphae []string) { filesAffected = rev.filesAffected() ) for _, filename := range filesAffected { - if strings.IndexRune(filename, '.') >= 0 { + if strings.ContainsRune(filename, '.') { dotPos := strings.LastIndexByte(filename, '.') hyphaName := string([]byte(filename)[0:dotPos]) // is it safe? if isNewName(hyphaName) { diff --git a/l18n/en/ui.json b/l18n/en/ui.json index 28a1de6..800bf0b 100644 --- a/l18n/en/ui.json +++ b/l18n/en/ui.json @@ -3,21 +3,11 @@ "register": "Register", "title_search": "Search by title", "admin_panel": "Admin panel", - - "search_results_title": "Search: {{.query}}", - "search_results_query": "Search results for ‘{{.query}}’", - "search_results_desc": "Every hypha name has been compared with the query. Hyphae that have matched the query are listed below.", - + "backlinks_title": "Backlinks to {{.hypha_name}}", "backlinks_heading": "Backlinks to {{.hypha_link}}", "backlinks_desc": "Hyphae which have a link to this hypha, embed it as an image or transclude it are listed below.", - "list_title": "List of pages", - "list_heading": "List of hyphae", - "list_desc": "This wiki has {{.n}} %s.", - "list_desc+one": "hypha", - "list_desc+other": "hyphae", - "edit_link": "Edit text", "logout_link": "Log out", "history_link": "View history", diff --git a/l18n/l18n.go b/l18n/l18n.go index 67b347b..da87f53 100644 --- a/l18n/l18n.go +++ b/l18n/l18n.go @@ -118,7 +118,7 @@ func (t Localizer) GetWithLocale(locale, key string, replacements ...*Replacemen // If the str doesn't have any substitutions, no need to // template.Execute. - if strings.Index(str, "}}") == -1 { + if strings.Contains(str, "}}") { return str } @@ -145,7 +145,7 @@ func (t Localizer) GetPlural(key string, n int, replacements ...*Replacements) s // As in the original, we skip templating if have nothing to replace // (however, it's strange case for plurals) - if strings.Index(str, "}}") == -1 { + if strings.Contains(str, "}}") { return str } @@ -164,7 +164,7 @@ func (t Localizer) GetPlural64(key string, n int64, replacements ...*Replacement // As in the original, we skip templating if have nothing to replace // (however, it's strange case for plurals) - if strings.Index(str, "}}") == -1 { + if strings.Contains(str, "}}") { return str } diff --git a/l18n/ru/ui.json b/l18n/ru/ui.json index 43285ac..83ae6ae 100644 --- a/l18n/ru/ui.json +++ b/l18n/ru/ui.json @@ -3,21 +3,10 @@ "register": "Регистрация", "title_search": "Поиск по названию", "admin_panel": "Администрирование", - - "search_results_title": "Поиск: {{.query}}", - "search_results_query": "Результаты поиска для «{{.query}}»", - "search_results_desc": "Название каждой из существующих гиф сопоставлено с запросом. Подходящие гифы приведены ниже.", - + "backlinks_title": "Обратные ссылки на {{.hypha_name}}", "backlinks_heading": "Обратные ссылки на {{.hypha_link}}", "backlinks_desc": "Ниже перечислены гифы, на которых есть ссылка на эту гифу, трансклюзия этой гифы или эта гифа вставлена как изображение.", - - "list_title": "Список страниц", - "list_heading": "Список гиф", - "list_desc": "В этой вики {{.n}} %s.", - "list_desc+one": "гифа", - "list_desc+few": "гифы", - "list_desc+many": "гиф", "edit_link": "Редактировать", "logout_link": "Выйти", diff --git a/shroom/log.go b/shroom/log.go index ecda380..2be9a70 100644 --- a/shroom/log.go +++ b/shroom/log.go @@ -7,9 +7,6 @@ import ( "github.com/bouncepaw/mycorrhiza/user" ) -func rejectDeleteLog(h hyphae.Hypha, u *user.User, errmsg string) { - log.Printf("Reject delete ‘%s’ by @%s: %s\n", h.CanonicalName(), u.Name, errmsg) -} func rejectRenameLog(h hyphae.Hypha, u *user.User, errmsg string) { log.Printf("Reject rename ‘%s’ by @%s: %s\n", h.CanonicalName(), u.Name, errmsg) } diff --git a/shroom/upload.go b/shroom/upload.go index 74e2ba5..df04d7c 100644 --- a/shroom/upload.go +++ b/shroom/upload.go @@ -97,7 +97,7 @@ func UploadText(h hyphae.Hypha, data []byte, userMessage string, u *user.User) e } // TODO: that []byte(...) part should be removed - if bytes.Compare(data, []byte(oldText)) == 0 { + if bytes.Equal(data, []byte(oldText)) { // No changes! Just like cancel button hop.Abort() return nil @@ -118,7 +118,7 @@ func UploadText(h hyphae.Hypha, data []byte, userMessage string, u *user.User) e } // TODO: that []byte(...) part should be removed - if bytes.Compare(data, []byte(oldText)) == 0 { + if bytes.Equal(data, []byte(oldText)) { // No changes! Just like cancel button hop.Abort() return nil diff --git a/views/admin.go b/views/admin.go index e9d8351..f0d9993 100644 --- a/views/admin.go +++ b/views/admin.go @@ -71,4 +71,7 @@ func AdminPanel(meta viewutil.Meta) { templateAsString(localizedAdminTemplates(meta), "panel title"), buf.String(), )) + if err != nil { + log.Println(err) + } }