From 65eadbd4b60d24323e15c6ae4e8377538e37244c Mon Sep 17 00:00:00 2001 From: Azareal Date: Sat, 2 Nov 2019 14:42:24 +1000 Subject: [PATCH] Show an inline error when there aren't any topics instead of a 404. Use a non-breaking space in the no topics error. --- routes/topic_list.go | 4 ---- templates/topics.html | 4 ++-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/routes/topic_list.go b/routes/topic_list.go index 3b879d2a..ee58f650 100644 --- a/routes/topic_list.go +++ b/routes/topic_list.go @@ -179,10 +179,6 @@ func TopicListCommon(w http.ResponseWriter, r *http.Request, user c.User, header if err != nil { return c.InternalError(err, w, r) } - // ! Need an inline error not a page level error - if len(topicList) == 0 { - return c.NotFound(w, r, header) - } // TODO: Reduce the amount of boilerplate here if r.FormValue("js") == "1" { diff --git a/templates/topics.html b/templates/topics.html index 11e6a348..81ec81f3 100644 --- a/templates/topics.html +++ b/templates/topics.html @@ -78,9 +78,9 @@
- {{range .TopicList}}{{template "topics_topic.html" . }}{{else}}
{{lang "topics_no_topics"}}{{if .CurrentUser.Loggedin}}{{if .CurrentUser.Perms.CreateTopic}} {{lang "topics_start_one"}}{{end}}{{end}}
{{end}} + {{range .TopicList}}{{template "topics_topic.html" . }}{{else}}
{{lang "topics_no_topics"}}{{if .CurrentUser.Loggedin}}{{if .CurrentUser.Perms.CreateTopic}} {{lang "topics_start_one"}}{{end}}{{end}}
{{end}}
{{template "paginator.html" . }} -{{template "footer.html" . }} +{{template "footer.html" . }} \ No newline at end of file