mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-03-27 06:13:04 -04:00
Update the Forgejo driver for gof3 with modifications for non-backward compatible changes. The changes are isolated behind the f3.Enable flag and not yet functional. The purpose of this upgrade is to not drift from the gof3 implementation while the work continues.
The `fix: include remote users when counting users` commit is a functional change to Forgejo itself but does not change the behavior because the remote users are only created in fixtures or by F3.
59c721d26b/models/user/user.go (L65-L66)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/10673
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: limiting-factor <limiting-factor@posteo.com>
Co-committed-by: limiting-factor <limiting-factor@posteo.com>
40 lines
1 KiB
Go
40 lines
1 KiB
Go
// Copyright Earl Warren <contact@earl-warren.org>
|
|
// Copyright Loïc Dachary <loic@dachary.org>
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package driver
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"forgejo.org/models/db"
|
|
issues_model "forgejo.org/models/issues"
|
|
|
|
f3_tree "code.forgejo.org/f3/gof3/v3/tree/f3"
|
|
f3_tree_generic "code.forgejo.org/f3/gof3/v3/tree/generic"
|
|
)
|
|
|
|
type issues struct {
|
|
container
|
|
}
|
|
|
|
func (o *issues) ListPage(ctx context.Context, node f3_tree_generic.NodeInterface, _ f3_tree_generic.ListOptions, page int) f3_tree_generic.ChildrenList {
|
|
pageSize := o.getPageSize()
|
|
|
|
project := f3_tree.GetProjectID(node)
|
|
|
|
forgejoIssues, err := issues_model.Issues(ctx, &issues_model.IssuesOptions{
|
|
Paginator: &db.ListOptions{Page: page, PageSize: pageSize},
|
|
RepoIDs: []int64{project},
|
|
})
|
|
if err != nil {
|
|
panic(fmt.Errorf("error while listing issues: %v", err))
|
|
}
|
|
|
|
return f3_tree.ConvertListed(ctx, node, f3_tree.ConvertToAny(forgejoIssues...)...)
|
|
}
|
|
|
|
func newIssues() f3_tree_generic.NodeDriverInterface {
|
|
return &issues{}
|
|
}
|