test superuser creation bug

This commit is contained in:
Simon Martens
2025-05-29 00:32:09 +02:00
parent 168a733af1
commit 4a4505d042
2 changed files with 51 additions and 43 deletions

View File

@@ -89,9 +89,9 @@ func (app *App) setupTestuser() BootFunc {
} }
superuser, err := e.App.FindAuthRecordByEmail(superusersCol, TEST_SUPERUSER_MAIL) superuser, err := e.App.FindAuthRecordByEmail(superusersCol, TEST_SUPERUSER_MAIL)
if err != nil { if err != nil && app.MAConfig.AllowTestLogin {
superuser = core.NewRecord(superusersCol) superuser = core.NewRecord(superusersCol)
} else if !app.MAConfig.AllowTestLogin { } else if err == nil && !app.MAConfig.AllowTestLogin {
// INFO: we to it as a raw query here since PB does not support deleting the last superuser // INFO: we to it as a raw query here since PB does not support deleting the last superuser
_, err = e.App.DB(). _, err = e.App.DB().
NewQuery("DELETE FROM " + superusersCol.Name + " WHERE id = '" + superuser.Id + "'"). NewQuery("DELETE FROM " + superusersCol.Name + " WHERE id = '" + superuser.Id + "'").
@@ -100,6 +100,8 @@ func (app *App) setupTestuser() BootFunc {
return fmt.Errorf("Failed to delete superuser account: %w.", err) return fmt.Errorf("Failed to delete superuser account: %w.", err)
} }
return nil
} else if err != nil {
return nil return nil
} }

View File

@@ -114,6 +114,11 @@
<div class="flex flex-row justify-end"> <div class="flex flex-row justify-end">
{{- if gt (len $model.result.Types) 1 -}} {{- if gt (len $model.result.Types) 1 -}}
<div> <div>
<form
method="GET"
hx-boost="false"
x-target="almanachcontents"
aria-label="Filter für Beitragstypen">
<label <label
for="typefilter" for="typefilter"
class="align-baseline h-min self-end pb-1 mr-1.5 text-sm font-sans text-stone-700"> class="align-baseline h-min self-end pb-1 mr-1.5 text-sm font-sans text-stone-700">
@@ -124,23 +129,27 @@
name="typefilter" name="typefilter"
id="typefilter" id="typefilter"
autocomplete="off" autocomplete="off"
hx-get="./" @change.debounce="$el.form.requestSubmit()">
trigger="change"
hx-indicator="body"
hx-select="#almanachcontents"
hx-target="#almanachcontents"
hx-swap="outerHTML show:none">
<option value="">Alle</option> <option value="">Alle</option>
{{- range $i, $t := $model.result.Types -}} {{- range $i, $t := $model.result.Types -}}
<option value="{{- $t -}}" {{- if eq $model.filters.Type $t -}}selected{{- end -}}> <option
value="{{- $t -}}"
{{- if eq $model.filters.Type $t -}}selected{{- end -}}>
{{- $t -}} {{- $t -}}
</option> </option>
{{- end -}} {{- end -}}
</select> </select>
<button x-show="false">Filtern</button>
</form>
</div> </div>
{{- end -}} {{- end -}}
{{- if $model.result.HasScans -}} {{- if $model.result.HasScans -}}
<div> <div>
<form
method="GET"
hx-boost="false"
x-target="almanachcontents"
aria-label="Filter für digialisierte Beiträge">
<label <label
for="onlyscans" for="onlyscans"
class="align-baseline h-min self-end pb-1 mr-1.5 text-sm font-sans text-stone-700"> class="align-baseline h-min self-end pb-1 mr-1.5 text-sm font-sans text-stone-700">
@@ -152,13 +161,10 @@
id="onlyscans" id="onlyscans"
name="onlyscans" name="onlyscans"
autocomplete="off" autocomplete="off"
hx-get="./" @change.debounce="$el.form.requestSubmit()"
trigger="change"
hx-select="#almanachcontents"
hx-target="#almanachcontents"
hx-swap="outerHTML show:none"
hx-indicator="body"
{{ if $model.filters.OnlyScans -}}checked{{- end -}} /> {{ if $model.filters.OnlyScans -}}checked{{- end -}} />
<button x-show="false">Filtern</button>
</form>
</div> </div>
{{- end -}} {{- end -}}
</div> </div>