From af2a8572a286e19b858c296b7b966b5389704dab Mon Sep 17 00:00:00 2001 From: gernest Date: Thu, 4 Jun 2015 18:17:52 +0300 Subject: [PATCH] bugfix --- msg.go | 1 + remix_test.go | 1 + utils.go | 7 ++++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/msg.go b/msg.go index cb87a51..265c4b0 100644 --- a/msg.go +++ b/msg.go @@ -181,6 +181,7 @@ func (m *Messenger) callMeBack(conn *golem.Connection, msg *golem.Message) *gole // persist a message func (m *Messenger) saveMsg(bucket string, profileID string, msg *MSG) error { + if msg.ID == "" { msg.ID = getUUID() } diff --git a/remix_test.go b/remix_test.go index 0326da7..9c8a1a6 100644 --- a/remix_test.go +++ b/remix_test.go @@ -687,6 +687,7 @@ func testServer(t *testing.T) (*httptest.Server, *http.Client, *Remix) { TemplatesExtensions: []string{".tmpl", ".html", ".tpl"}, SessMaxAge: 30, SessionPath: "/", + MessagesBucket:"messages", } rx := NewRemix(cfg) jar, err := cookiejar.New(nil) diff --git a/utils.go b/utils.go index da6f283..12cd396 100644 --- a/utils.go +++ b/utils.go @@ -20,7 +20,12 @@ func marshalAndCreate(db nutz.Storage, obj interface{}, buck, key string, nest . if err != nil { return err } - c := db.Create(buck, key, data, nest...) + if len(nest) > 0 { + c := db.Create(buck, key, data, nest...) + return c.Error + + } + c := db.Create(buck, key, data) return c.Error }