commento.js: don't recursively delete comments
This commit is contained in:
@@ -16,4 +16,5 @@ type comment struct {
|
||||
State string `json:"state,omitempty"`
|
||||
CreationDate time.Time `json:"creationDate"`
|
||||
Direction int `json:"direction"`
|
||||
Deleted bool `json:"deleted"`
|
||||
}
|
||||
|
@@ -10,8 +10,9 @@ func commentDelete(commentHex string) error {
|
||||
}
|
||||
|
||||
statement := `
|
||||
DELETE FROM comments
|
||||
WHERE commentHex=$1;
|
||||
UPDATE comments
|
||||
SET deleted = true, markdown = '[deleted]', html = '[deleted]', commenterHex = 'anonymous'
|
||||
WHERE commentHex = $1;
|
||||
`
|
||||
_, err := db.Exec(statement, commentHex)
|
||||
|
||||
|
@@ -16,6 +16,7 @@ func commentGetByCommentHex(commentHex string) (comment, error) {
|
||||
parentHex,
|
||||
score,
|
||||
state,
|
||||
deleted,
|
||||
creationDate
|
||||
FROM comments
|
||||
WHERE comments.commentHex = $1;
|
||||
@@ -31,6 +32,7 @@ func commentGetByCommentHex(commentHex string) (comment, error) {
|
||||
&c.ParentHex,
|
||||
&c.Score,
|
||||
&c.State,
|
||||
&c.Deleted,
|
||||
&c.CreationDate); err != nil {
|
||||
// TODO: is this the only error?
|
||||
return c, errorNoSuchComment
|
||||
|
@@ -20,6 +20,7 @@ func commentList(commenterHex string, domain string, path string, includeUnappro
|
||||
parentHex,
|
||||
score,
|
||||
state,
|
||||
deleted,
|
||||
creationDate
|
||||
FROM comments
|
||||
WHERE
|
||||
@@ -66,6 +67,7 @@ func commentList(commenterHex string, domain string, path string, includeUnappro
|
||||
&c.ParentHex,
|
||||
&c.Score,
|
||||
&c.State,
|
||||
&c.Deleted,
|
||||
&c.CreationDate); err != nil {
|
||||
return nil, nil, errorInternal
|
||||
}
|
||||
|
Reference in New Issue
Block a user