feat: contract.Rebuilder asks for a debounced rebuild
The sitemap publishes classes.Listing as contract.Rebuilder too, so a plugin whose Filter reads data of its own can queue the debounced rebuild a record event queues when that data changes.
This commit is contained in:
@@ -20,7 +20,10 @@ type Listing struct {
|
||||
App *backpack.App
|
||||
}
|
||||
|
||||
var _ contract.Listing = Listing{}
|
||||
var (
|
||||
_ contract.Listing = Listing{}
|
||||
_ contract.Rebuilder = Listing{}
|
||||
)
|
||||
|
||||
// The page sizes of Entries.
|
||||
const (
|
||||
@@ -39,6 +42,17 @@ func (l Listing) db(ctx context.Context) (*gorm.DB, error) {
|
||||
return db.WithContext(ctx), nil
|
||||
}
|
||||
|
||||
// RequestRebuild queues one debounced rebuild through
|
||||
// RequestDebouncedRebuild, the same one a record event queues
|
||||
// (contract.Rebuilder).
|
||||
func (l Listing) RequestRebuild(ctx context.Context) error {
|
||||
db, err := l.db(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return RequestDebouncedRebuild(ctx, l.App, db)
|
||||
}
|
||||
|
||||
// Settings answers the site address, the index address, the default
|
||||
// locale and the groups with listed addresses (by key), with their titles
|
||||
// (a content type's saved HTML sitemap headings, else the titles of the
|
||||
|
||||
Reference in New Issue
Block a user