mirror of
https://github.com/hrfee/jfa-go.git
synced 2024-12-22 09:00:10 +00:00
db: remove remaining storage.loadX calls
This commit is contained in:
parent
ea0598e507
commit
e1c215b72e
@ -15,7 +15,6 @@ import (
|
||||
|
||||
func (app *appContext) checkInvites() {
|
||||
currentTime := time.Now()
|
||||
app.storage.loadInvites()
|
||||
for _, data := range app.storage.GetInvites() {
|
||||
expiry := data.ValidTill
|
||||
if !currentTime.After(expiry) {
|
||||
@ -59,7 +58,6 @@ func (app *appContext) checkInvites() {
|
||||
|
||||
func (app *appContext) checkInvite(code string, used bool, username string) bool {
|
||||
currentTime := time.Now()
|
||||
app.storage.loadInvites()
|
||||
inv, match := app.storage.GetInvitesKey(code)
|
||||
if !match {
|
||||
return false
|
||||
@ -128,7 +126,6 @@ func (app *appContext) checkInvite(code string, used bool, username string) bool
|
||||
func (app *appContext) GenerateInvite(gc *gin.Context) {
|
||||
var req generateInviteDTO
|
||||
app.debug.Println("Generating new invite")
|
||||
app.storage.loadInvites()
|
||||
gc.BindJSON(&req)
|
||||
currentTime := time.Now()
|
||||
validTill := currentTime.AddDate(0, req.Months, req.Days)
|
||||
@ -222,7 +219,6 @@ func (app *appContext) GenerateInvite(gc *gin.Context) {
|
||||
func (app *appContext) GetInvites(gc *gin.Context) {
|
||||
app.debug.Println("Invites requested")
|
||||
currentTime := time.Now()
|
||||
app.storage.loadInvites()
|
||||
app.checkInvites()
|
||||
var invites []inviteDTO
|
||||
for _, inv := range app.storage.GetInvites() {
|
||||
@ -344,8 +340,6 @@ func (app *appContext) SetNotify(gc *gin.Context) {
|
||||
changed := false
|
||||
for code, settings := range req {
|
||||
app.debug.Printf("%s: Notification settings change requested", code)
|
||||
app.storage.loadInvites()
|
||||
app.storage.loadEmails()
|
||||
invite, ok := app.storage.GetInvitesKey(code)
|
||||
if !ok {
|
||||
app.err.Printf("%s Notification setting change failed: Invalid code", code)
|
||||
|
@ -42,11 +42,6 @@ func (app *appContext) MyDetails(gc *gin.Context) {
|
||||
resp.Expiry = exp.Expiry.Unix()
|
||||
}
|
||||
|
||||
app.storage.loadEmails()
|
||||
app.storage.loadDiscordUsers()
|
||||
app.storage.loadMatrixUsers()
|
||||
app.storage.loadTelegramUsers()
|
||||
|
||||
if emailEnabled {
|
||||
resp.Email = &MyDetailsContactMethodsDTO{}
|
||||
if email, ok := app.storage.GetEmailsKey(user.ID); ok && email.Addr != "" {
|
||||
|
@ -116,7 +116,6 @@ func (rt *housekeepingDaemon) run() {
|
||||
break
|
||||
}
|
||||
started := time.Now()
|
||||
rt.app.storage.loadInvites()
|
||||
|
||||
for _, job := range rt.jobs {
|
||||
job(rt.app)
|
||||
|
@ -100,7 +100,6 @@ func pwrMonitor(app *appContext, watcher *fsnotify.Watcher) {
|
||||
app.debug.Printf("Error: %s", err)
|
||||
return
|
||||
}
|
||||
app.storage.loadEmails()
|
||||
uid := user.ID
|
||||
if uid == "" {
|
||||
app.err.Printf("Couldn't get user ID for user \"%s\"", pwr.Username)
|
||||
|
Loading…
Reference in New Issue
Block a user