everywhere: improve anonymous comments logic

This commit is contained in:
Adhityaa Chandrasekar
2019-01-23 00:26:22 -05:00
parent 61bc73e705
commit 022fc06257
10 changed files with 52 additions and 35 deletions

View File

@@ -78,12 +78,13 @@ func commentNewHandler(w http.ResponseWriter, r *http.Request) {
}
// logic: (empty column indicates the value doesn't matter)
// | anonymous | moderator | requireIdentification | requireModeration | approved? |
// |-----------+-----------+-----------------------+-------------------+-----------|
// | yes | | | | no |
// | no | yes | | | yes |
// | no | no | | yes | yes |
// | no | no | | no | no |
// | anonymous | moderator | requireIdentification | requireModeration | moderateAllAnonymous | approved? |
// |-----------+-----------+-----------------------+-------------------+----------------------+-----------|
// | yes | | | | no | yes |
// | yes | | | | yes | no |
// | no | yes | | | | yes |
// | no | no | | yes | | yes |
// | no | no | | no | | no |
var commenterHex string
var state string
@@ -93,7 +94,11 @@ func commentNewHandler(w http.ResponseWriter, r *http.Request) {
if isSpam(*x.Domain, getIp(r), getUserAgent(r), "Anonymous", "", "", *x.Markdown) {
state = "flagged"
} else {
state = "unapproved"
if d.ModerateAllAnonymous {
state = "unapproved"
} else {
state = "approved"
}
}
} else {
c, err := commenterGetByCommenterToken(*x.CommenterToken)