User Management: Fix regressions

This commit is contained in:
Tom Wiesing 2023-01-10 14:20:37 +01:00
parent 6f257bd27f
commit 66e57183d6
No known key found for this signature in database
6 changed files with 17 additions and 10 deletions

View file

@ -47,6 +47,10 @@ func (instances *Instances) use(wisski *wisski.WissKI) {
// WissKI returns the WissKI with the provided slug, if it exists.
// It the WissKI does not exist, returns ErrWissKINotFound.
func (instances *Instances) WissKI(ctx context.Context, slug string) (wissKI *wisski.WissKI, err error) {
if slug == "" {
return nil, ErrWissKINotFound
}
sql := instances.Dependencies.SQL
if err := sql.WaitQueryTable(ctx); err != nil {
return nil, err
@ -61,7 +65,7 @@ func (instances *Instances) WissKI(ctx context.Context, slug string) (wissKI *wi
wissKI = new(wisski.WissKI)
// find the instance by slug
query := table.Where(&models.Instance{Slug: slug}).Find(&wissKI.Liquid.Instance)
query := table.Find(&wissKI.Liquid.Instance, &models.Instance{Slug: slug})
switch {
case query.Error != nil:
return nil, errSQL.WithMessageF(query.Error)