api: update commenter information on new login

This commit is contained in:
Adhityaa Chandrasekar
2019-08-11 15:52:56 -07:00
parent 696361df4a
commit 9538c9036e
6 changed files with 68 additions and 13 deletions

View File

@@ -76,7 +76,6 @@ func gitlabCallbackHandler(w http.ResponseWriter, r *http.Request) {
var commenterHex string
// TODO: in case of returning users, update the information we have on record?
if err == errorNoSuchCommenter {
commenterHex, err = commenterNew(email, name, link, photo, "gitlab", "")
if err != nil {
@@ -84,6 +83,11 @@ func gitlabCallbackHandler(w http.ResponseWriter, r *http.Request) {
return
}
} else {
if err = commenterUpdate(c.CommenterHex, email, name, link, photo, "gitlab"); err != nil {
logger.Warningf("cannot update commenter: %s", err)
// not a serious enough to exit with an error
}
commenterHex = c.CommenterHex
}