userByName reloads cache if user not found, more things in test

This commit is contained in:
Harvey Tindall
2020-09-16 19:19:04 +01:00
parent 802f957d22
commit 7d84fdec96
4 changed files with 30 additions and 7 deletions

View File

@@ -67,6 +67,12 @@ func pwrMonitor(app *appContext, watcher *fsnotify.Watcher) {
}
app.storage.loadEmails()
var address string
uid := user["Id"]
if uid == nil {
app.err.Printf("Couldn't get user ID for user \"%s\"", pwr.Username)
app.debug.Printf("user maplength: %d", len(user))
return
}
addr, ok := app.storage.emails[user["Id"].(string)]
if !ok || addr == nil {
app.err.Printf("Couldn't find email for user \"%s\". Make sure it's set", pwr.Username)