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:
Florian Sylvain committed 2026-11-03 16:01:52 +01:00
1 parent 9d284e65a9
commit 7c15206170
85 files changed
+1788 -593

No files matched your search

+4 -6
View File
@@ -39,6 +39,7 @@ const (
storyPublish uint32 = 55
storyNobody uint32 = 56
storyPartial uint32 = 57
storyDeleter uint32 = 58
storyAnon uint32 = 0
storyStory uint32 = 5
)
@@ -62,7 +63,6 @@ type storyTransactor struct {
world *storyWorld
runs int
external map[uint32]article.Article
starting map[uint32]string
removed map[uint32]bool
}
@@ -74,11 +74,7 @@ func (s *storyTransactor) Run(ctx context.Context, work func(transaction.Reposit
articles := maps.Clone(w.articles.articles)
credits := maps.Clone(w.articles.credits)
rows, _ := w.rows.snapshot()
starting := map[uint32]string{storyJournal: "en", storyAtelier: "en"}
if s.starting != nil {
starting = s.starting
}
err := work(transaction.Repositories{Articles: w.articles, Sites: w.sites, Authors: w.authors, Localization: w.rows, Languages: &mockStartingLanguages{confirmed: starting, removed: s.removed}})
err := work(transaction.Repositories{Articles: w.articles, Sites: removableSites{mockSiteRepo: w.sites, removed: s.removed}, Authors: w.authors, Localization: w.rows, ArticleSEO: w.articles})
if err != nil {
w.articles.articles = articles
w.articles.credits = credits
@@ -136,6 +132,7 @@ func (w *storyWorld) seedUsers() {
storyPublish: {"content.publish=all", "content.read=all"},
storyNobody: {"schema.view=all"},
storyPartial: {"content.update=all", "content.read=own"},
storyDeleter: {"content.delete=all", "content.read=own"},
}
for id, grants := range custom {
created, _ := w.roles.Create(role.Role{Name: "story-role-" + strconv.FormatUint(uint64(id), 10), Version: 1, Grants: grantRows(grants...)})
@@ -204,6 +201,7 @@ func (w *storyWorld) wire() {
CreateTranslationUseCase: useCases.NewCreateTranslationUseCase(w.transactor, w.articles, w.rows, renderer, w.recorder),
DescribeArticleUseCase: useCases.NewDescribeArticleUseCase(w.articles, w.rows),
MoveStoryUseCase: moveStory,
DeleteStoryUseCase: useCases.NewDeleteStoryUseCase(w.transactor, w.articles, w.recorder),
}
router := chi.NewRouter()
router.Use(authtoken.Verifier(w.token))