refac: migration crash, real-database tests, site deleted during create, ruels out of the repo, lists
This commit is contained in:
1 parent
680b9a1308
commit
9d284e65a9
62 files changed
+1858
-987
No files matched your search
@@ -72,3 +72,19 @@ type SiteLanguage struct {
|
||||
Enabled bool
|
||||
Confirmed bool
|
||||
}
|
||||
|
||||
func DefaultOf(languages []SiteLanguage) (SiteLanguage, bool) {
|
||||
index := slices.IndexFunc(languages, func(candidate SiteLanguage) bool { return candidate.IsDefault })
|
||||
if index < 0 {
|
||||
return SiteLanguage{}, false
|
||||
}
|
||||
return languages[index], true
|
||||
}
|
||||
|
||||
func StartingTag(languages []SiteLanguage) string {
|
||||
defaultLanguage, found := DefaultOf(languages)
|
||||
if !found || !defaultLanguage.Confirmed {
|
||||
return Unassigned
|
||||
}
|
||||
return defaultLanguage.Tag
|
||||
}
|
||||
Reference in new issue
Block a user