fix check for double-edits

This commit is contained in:
Umputun
2018-01-03 13:50:35 -06:00
parent 093df05b65
commit 1de76f2b5e
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -51,7 +51,7 @@ func (s *Service) EditComment(locator Locator, commentID string, text string, ed
return comment, err
}
// edit allowed only once
if !comment.Edit.Timestamp.IsZero() {
if comment.Edit != nil {
return comment, errors.Errorf("comment %s already edited at %s", commentID, comment.Edit.Timestamp)
}
+1 -1
View File
@@ -64,7 +64,7 @@ func TestBoltDB_EditComment(t *testing.T) {
t.Logf("%+v", res[0])
assert.Nil(t, err)
assert.Equal(t, 2, len(res))
assert.Equal(t, Edit{}, res[0].Edit)
assert.Nil(t, res[0].Edit)
comment, err := b.EditComment(Locator{URL: "https://radio-t.com", SiteID: "radio-t"}, res[0].ID, "xxx", Edit{Summary: "my edit"})
assert.Nil(t, err)