to_upstream #1

Closed
mountain wants to merge 12 commits from ws:to_upstream into master
Showing only changes of commit 4d6482c441 - Show all commits

View File

@ -169,7 +169,11 @@ func (caller apiCaller) blockAPI(w http.ResponseWriter, r *http.Request) error {
json.NewEncoder(w).Encode(mg.bl.all())
} else if !target.IsZero() {
if blocked, ok := mg.bl.get(target); ok && blocked != nil {
json.NewEncoder(w).Encode(blocked)
if !blocked.Expired() {
json.NewEncoder(w).Encode(blocked)
} else {
mg.bl.remove(target)
}
}
}
} else if r.Method == "PUT" {
@ -200,7 +204,6 @@ func (caller apiCaller) blockAPI(w http.ResponseWriter, r *http.Request) error {
logger.Println("account is blocked :", meta)
bi.Accid = accid
caller.mg.bl.add(&bi)
mg.sessionProvider.RevokeAll(accid)
}
}
@ -226,8 +229,6 @@ func (caller apiCaller) blockAPI(w http.ResponseWriter, r *http.Request) error {
if err != nil {
return err
}
caller.mg.bl.remove(idobj)
}
return nil
}