From fd1d54c39429b19afe3df6a778d3a6949e70b8ee Mon Sep 17 00:00:00 2001 From: Azareal Date: Sun, 13 Oct 2019 20:50:15 +1000 Subject: [PATCH] Wrestling with tests while pushing random changes. --- common/relations.go | 11 ++++++++--- parser_test.go | 4 ++-- routes/panel/forums.go | 8 ++++---- templates/panel_forums.html | 8 ++++---- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/common/relations.go b/common/relations.go index 631969d0..c770f66b 100644 --- a/common/relations.go +++ b/common/relations.go @@ -32,7 +32,8 @@ func (s *DefaultBlockStore) IsBlockedBy(blocker, blockee int) (bool, error) { } func (s *DefaultBlockStore) Add(blocker, blockee int) error { - return nil + _, err := s.add.Exec(blocker, blockee) + return err } type FriendInvite struct { @@ -64,11 +65,15 @@ func NewDefaultFriendStore(acc *qgen.Accumulator) (*DefaultFriendStore, error) { } func (s *DefaultFriendStore) AddInvite(requester, target int) error { - return nil + _, err := s.addInvite.Exec(requester, target) + return err } + func (s *DefaultFriendStore) Confirm(requester, target int) error { - return nil + _, err := s.confirm.Exec(requester, target) + return err } + func (s *DefaultFriendStore) GetOwnSentInvites(uid int) ([]FriendInvite, error) { return nil, nil } diff --git a/parser_test.go b/parser_test.go index 747bc38e..9015f4fe 100644 --- a/parser_test.go +++ b/parser_test.go @@ -202,6 +202,8 @@ func TestParser(t *testing.T) { l.Add("//"+url+"\n//"+url, eurl+"
"+eurl) l.Add("//"+url+"\n\n//"+url, eurl+"

"+eurl) + pre2 := c.Site.EnableSsl + c.Site.EnableSsl = true local := func(u string) { s := "//" + c.Site.URL fs := "http://" + c.Site.URL @@ -288,8 +290,6 @@ func TestParser(t *testing.T) { l.Add("@-1", "[Invalid Profile]1") // TODO: Fix this hack and make the results a bit more reproducible, push the tests further in the process. - pre2 := c.Site.EnableSsl - c.Site.EnableSsl = true for _, item := range l.Items { if res := c.ParseMessage(item.Msg, 1, "forums"); res != item.Expects { if item.Name != "" { diff --git a/routes/panel/forums.go b/routes/panel/forums.go index aa0cf9fe..8618d0a6 100644 --- a/routes/panel/forums.go +++ b/routes/panel/forums.go @@ -61,10 +61,10 @@ func ForumsCreateSubmit(w http.ResponseWriter, r *http.Request, user c.User) c.R return c.NoPermissions(w, r, user) } - fname := r.PostFormValue("forum-name") - fdesc := r.PostFormValue("forum-desc") - fpreset := c.StripInvalidPreset(r.PostFormValue("forum-preset")) - factive := r.PostFormValue("forum-active") + fname := r.PostFormValue("name") + fdesc := r.PostFormValue("desc") + fpreset := c.StripInvalidPreset(r.PostFormValue("preset")) + factive := r.PostFormValue("active") active := (factive == "on" || factive == "1") _, err := c.Forums.Create(fname, fdesc, active, fpreset) diff --git a/templates/panel_forums.html b/templates/panel_forums.html index 956cf926..bd73c23b 100644 --- a/templates/panel_forums.html +++ b/templates/panel_forums.html @@ -37,22 +37,22 @@
-
-