don't set predefined text in deleted

This commit is contained in:
Umputun
2018-03-19 01:47:22 -05:00
parent bb185a0a3c
commit dadb3666af
3 changed files with 5 additions and 4 deletions
+3 -2
View File
@@ -41,7 +41,7 @@ func TestAdmin_Delete(t *testing.T) {
cr := store.Comment{}
err = json.Unmarshal([]byte(body), &cr)
assert.Nil(t, err)
assert.Equal(t, "this comment was deleted", cr.Text)
assert.Equal(t, "", cr.Text)
assert.True(t, cr.Deleted)
}
@@ -131,7 +131,8 @@ func TestAdmin_Block(t *testing.T) {
err = json.Unmarshal([]byte(res), &comments)
assert.Nil(t, err)
assert.Equal(t, 2, len(comments), "should have 2 comments")
assert.Equal(t, "this comment was deleted", comments[0].Text)
assert.Equal(t, "", comments[0].Text)
assert.True(t, comments[0].Deleted)
code, body = block(-1)
require.Equal(t, 200, code)
+1 -1
View File
@@ -41,7 +41,7 @@ func TestBoltDB_Delete(t *testing.T) {
res, err = b.Find(loc, "time")
assert.Nil(t, err)
assert.Equal(t, 2, len(res))
assert.Equal(t, "this comment was deleted", res[0].Text)
assert.Equal(t, "", res[0].Text)
assert.True(t, res[0].Deleted, "marked deleted")
assert.Equal(t, "some text2", res[1].Text)
assert.False(t, res[1].Deleted)
+1 -1
View File
@@ -86,7 +86,7 @@ func (c *Comment) Sanitize() {
// SetDeleted clears comment info, reset to deleted state
func (c *Comment) SetDeleted() {
c.Text = "this comment was deleted"
c.Text = ""
c.Score = 0
c.Votes = map[string]bool{}
c.Edit = nil