unlock room if no admins online

This commit is contained in:
Craig 2020-04-06 20:14:08 +00:00
parent 82ca6e13ca
commit 414b5a8015
3 changed files with 24 additions and 4 deletions

View file

@ -42,6 +42,10 @@ func (h *MessageHandler) Connected(id string, socket *WebSocket) (bool, string,
}
func (h *MessageHandler) Disconnected(id string) error {
if h.locked && len(h.sessions.Admins()) == 0 {
h.locked = false
}
return h.sessions.Destroy(id)
}