fix check for double-edits
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user