From afedc78113ce524e282c15d9deb90d35facb0a4e Mon Sep 17 00:00:00 2001 From: Harvey Tindall Date: Tue, 6 Apr 2021 13:53:07 +0100 Subject: [PATCH] only load users if they don't exist already another guess for #77. --- storage.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/storage.go b/storage.go index 447f6a0..61c55a0 100644 --- a/storage.go +++ b/storage.go @@ -482,7 +482,17 @@ func (st *Storage) storeInvites() error { func (st *Storage) loadUsers() error { st.usersLock.Lock() defer st.usersLock.Unlock() - return loadJSON(st.users_path, &st.users) + temp := map[string]time.Time{} + err := loadJSON(st.users_path, &temp) + if err != nil { + return err + } + for id, t1 := range temp { + if _, ok := st.users[id]; !ok { + st.users[id] = t1 + } + } + return nil } func (st *Storage) storeUsers() error {