refac: article reads, story delete, no leaks, stored SEO status, rate limit, cleanup (%site%, article repo split, old lang repos, one default per site rule to domain)
This commit is contained in:
1 parent
9d284e65a9
commit
7c15206170
85 files changed
+1788
-593
No files matched your search
@@ -13,6 +13,7 @@ var (
|
||||
ErrSetupInProgress = errors.New("another language setup is running")
|
||||
ErrSetupIncomplete = errors.New("every pending site needs a language")
|
||||
ErrDuplicateSite = errors.New("the same site is listed twice")
|
||||
ErrSingleDefault = errors.New("a site has exactly one default language")
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -128,6 +128,34 @@ func MissingTags(rows []Row, tags []string) []string {
|
||||
return missing
|
||||
}
|
||||
|
||||
func ConfirmedDefaultTag(rows []Row) string {
|
||||
if NeedsSetup(rows) {
|
||||
return language.Unassigned
|
||||
}
|
||||
return DefaultTag(rows)
|
||||
}
|
||||
|
||||
func SiteTextAllowed(defaultTag string, tag string) bool {
|
||||
return tag == language.Unassigned || tag == defaultTag
|
||||
}
|
||||
|
||||
func PublicTag(rows []Row, tag string) bool {
|
||||
return tag != language.Unassigned && EnabledTag(rows, tag)
|
||||
}
|
||||
|
||||
func RequireSingleDefault(rows []Row) error {
|
||||
defaults := 0
|
||||
for _, row := range rows {
|
||||
if row.IsDefault {
|
||||
defaults++
|
||||
}
|
||||
}
|
||||
if defaults != 1 {
|
||||
return ErrSingleDefault
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func DefaultTag(rows []Row) string {
|
||||
for _, row := range rows {
|
||||
if row.IsDefault {
|
||||
|
||||
Reference in new issue
Block a user