comment_list.go: check for moderator status conditionally

This commit is contained in:
Adhityaa Chandrasekar 2019-05-01 18:53:33 -04:00
parent a9c48a8394
commit e1effd2a45

View File

@ -131,6 +131,10 @@ func commentListHandler(w http.ResponseWriter, r *http.Request) {
} }
commenterHex := "anonymous" commenterHex := "anonymous"
isModerator := false
modList := map[string]bool{}
if *x.CommenterToken != "anonymous" {
c, err := commenterGetByCommenterToken(*x.CommenterToken) c, err := commenterGetByCommenterToken(*x.CommenterToken)
if err != nil { if err != nil {
if err == errorNoSuchToken { if err == errorNoSuchToken {
@ -143,14 +147,17 @@ func commentListHandler(w http.ResponseWriter, r *http.Request) {
commenterHex = c.CommenterHex commenterHex = c.CommenterHex
} }
isModerator := false
modList := map[string]bool{}
for _, mod := range d.Moderators { for _, mod := range d.Moderators {
modList[mod.Email] = true modList[mod.Email] = true
if mod.Email == c.Email { if mod.Email == c.Email {
isModerator = true isModerator = true
} }
} }
} else {
for _, mod := range d.Moderators {
modList[mod.Email] = true
}
}
domainViewRecord(domain, commenterHex) domainViewRecord(domain, commenterHex)