diff --git a/common/reply_store.go b/common/reply_store.go index 1879a6bf..169d4c1f 100644 --- a/common/reply_store.go +++ b/common/reply_store.go @@ -42,10 +42,10 @@ func NewSQLReplyStore(acc *qgen.Accumulator, cache ReplyCache) (*SQLReplyStore, re := "replies" return &SQLReplyStore{ cache: cache, - get: acc.Select(re).Columns("tid, content, createdBy, createdAt, lastEdit, lastEditBy, ip, likeCount, attachCount, actionType").Where("rid=?").Prepare(), + get: acc.Select(re).Columns("tid,content,createdBy,createdAt,lastEdit,lastEditBy,ip,likeCount,attachCount,actionType").Where("rid=?").Prepare(), getAll: acc.Select(re).Columns("rid,tid,content,createdBy,createdAt,lastEdit,lastEditBy,ip,likeCount,attachCount,actionType").Prepare(), exists: acc.Exists(re, "rid").Prepare(), - create: acc.Insert(re).Columns("tid, content, parsed_content, createdAt, lastUpdated, ip, words, createdBy").Fields("?,?,?,UTC_TIMESTAMP(),UTC_TIMESTAMP(),?,?,?").Prepare(), + create: acc.Insert(re).Columns("tid,content,parsed_content,createdAt,lastUpdated,ip,words,createdBy").Fields("?,?,?,UTC_TIMESTAMP(),UTC_TIMESTAMP(),?,?,?").Prepare(), count: acc.Count(re).Prepare(), countUser: acc.Count(re).Where("createdBy=?").Prepare(), countWordUser: acc.Count(re).Where("createdBy=? AND words>=?").Prepare(), diff --git a/misc_test.go b/misc_test.go index b49638c6..f897ae9f 100644 --- a/misc_test.go +++ b/misc_test.go @@ -1803,6 +1803,46 @@ func TestWordFilters(t *testing.T) { // TODO: Any more tests we could do? } +func TestMFAStore(t *testing.T) { + _, err := c.MFAstore.Get(-1) + recordMustNotExist(t, err, "mfa uid -1 should not exist") + _, err = c.MFAstore.Get(0) + recordMustNotExist(t, err, "mfa uid 0 should not exist") + _, err = c.MFAstore.Get(1) + recordMustNotExist(t, err, "mfa uid 1 should not exist") + + secret := "test" + expectNilErr(t, c.MFAstore.Create(secret, 1)) + _, err = c.MFAstore.Get(0) + recordMustNotExist(t, err, "mfa uid 0 should not exist") + var scratches []string + it, err := c.MFAstore.Get(1) + test := func(j int) { + expectNilErr(t, err) + expect(t, it.UID == 1, fmt.Sprintf("UID should be 1 not %d", it.UID)) + expect(t, it.Secret == secret, fmt.Sprintf("Secret should be '%s' not %s", secret, it.Secret)) + expect(t, len(it.Scratch) == 8, fmt.Sprintf("Scratch should be 8 not %d", len(it.Scratch))) + for i, scratch := range it.Scratch { + expect(t, scratch != "", fmt.Sprintf("scratch %d should not be empty", i)) + if scratches != nil { + if j == i { + expect(t, scratches[i] != scratch, fmt.Sprintf("scratches[%d] should not be %s", i, scratches[i])) + } else { + expect(t, scratches[i] == scratch, fmt.Sprintf("scratches[%d] should be %s not %s", i, scratches[i], scratch)) + } + } + } + scratches = make([]string, 8) + copy(scratches, it.Scratch) + } + test(0) + for i := 0; i < len(scratches); i++ { + expectNilErr(t, it.BurnScratch(i)) + it, err = c.MFAstore.Get(1) + test(i) + } +} + // TODO: Expand upon the valid characters which can go in URLs? func TestSlugs(t *testing.T) { l := &MEPairList{nil} diff --git a/templates/forums.html b/templates/forums.html index 11972d42..f138783b 100644 --- a/templates/forums.html +++ b/templates/forums.html @@ -5,21 +5,21 @@

{{lang "forums_head"}}

- {{range .ItemList}}
{{.Name}}
{{if .Desc}} - {{.Desc}} + {{.Desc}} {{else}} {{lang "forums_no_description"}} {{end}}
- {{if .LastReplyer.MicroAvatar}}{{end}} + {{if .LastReplyer.MicroAvatar}}{{end}} {{if .LastTopic.Title}}{{.LastTopic.Title}}{{else}}{{lang "forums_none"}}{{end}} - {{if .LastTopicTime}}
{{.LastTopicTime}}{{end}} + {{if .LastTopicTime}}
{{.LastTopicTime}}{{end}}
diff --git a/templates/profile_comments_row_alt.html b/templates/profile_comments_row_alt.html index 2d5abbec..ea4fde71 100644 --- a/templates/profile_comments_row_alt.html +++ b/templates/profile_comments_row_alt.html @@ -4,16 +4,16 @@
- {{.CreatedByName}} + {{.CreatedByName}} {{if .Tag}}{{.Tag}}{{end}}
{{if $.CurrentUser.IsMod}} - - + + {{end}} - +
diff --git a/templates/topics_topic.html b/templates/topics_topic.html index 854c9f2d..49a139aa 100644 --- a/templates/topics_topic.html +++ b/templates/topics_topic.html @@ -3,7 +3,7 @@ - {{.Title}} {{if .ForumName}}{{.ForumName}}{{end}} + {{.Title}} {{if .ForumName}}{{.ForumName}}{{end}}
{{.Creator.Name}} {{/** TODO: Avoid the double '|' when both .IsClosed and .Sticky are set to true. We could probably do this with CSS **/}} {{if .IsClosed}} | 🔒︎{{end}} @@ -24,10 +24,10 @@
- + - {{.LastUser.Name}}
- {{reltime .LastReplyAt}} + {{.LastUser.Name}}
+ {{reltime .LastReplyAt}}
diff --git a/themes/nox/overrides/panel_group_menu.html b/themes/nox/overrides/panel_group_menu.html index 0341da19..d962293c 100644 --- a/themes/nox/overrides/panel_group_menu.html +++ b/themes/nox/overrides/panel_group_menu.html @@ -1,4 +1,4 @@ -