Skip to content

Commit

Permalink
Skip app/bot per user limit if it is zero
Browse files Browse the repository at this point in the history
  • Loading branch information
xwjdsh authored and lyricat committed Apr 18, 2023
1 parent 30f9834 commit 690e514
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion handler/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func CreateApp(appz core.AppService, appPerUserLimit int) http.HandlerFunc {
return
}

if len(appArr) >= appPerUserLimit {
if appPerUserLimit != 0 && len(appArr) >= appPerUserLimit {
render.Error(w, http.StatusBadRequest, core.ErrAppLimitReached)
return
}
Expand Down
2 changes: 1 addition & 1 deletion handler/bot/bot.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ func CreateBot(botz core.BotService, models core.ModelStore, botPerUserLimit int
}

botArr, _ := botz.GetBotsByUserID(ctx, user.ID)
if len(botArr) >= botPerUserLimit {
if botPerUserLimit != 0 && len(botArr) >= botPerUserLimit {
render.Error(w, http.StatusBadRequest, core.ErrAppLimitReached)
return
}
Expand Down

0 comments on commit 690e514

Please sign in to comment.