Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-24 02:36:10 +01:00

feat: upgrade F3 to v3.7.0

* support changing label colors
* support changing issue state
* use helpers to keep type conversions DRY
* drop the x/exp license because it is no longer used

The tests are performed by the gof3 compliance suite
This commit is contained in:
limiting-factor 2024-08-18 18:53:54 +02:00 committed by Earl Warren
parent 4760c5029d
commit b26a0aea19
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
23 changed files with 50 additions and 56 deletions

View file

@ -1019,11 +1019,6 @@
"path": "golang.org/x/crypto/LICENSE",
"licenseText": "Copyright 2009 The Go Authors.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\n\n * Redistributions of source code must retain the above copyright\nnotice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above\ncopyright notice, this list of conditions and the following disclaimer\nin the documentation and/or other materials provided with the\ndistribution.\n * Neither the name of Google LLC nor the names of its\ncontributors may be used to endorse or promote products derived from\nthis software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n"
},
{
"name": "golang.org/x/exp",
"path": "golang.org/x/exp/LICENSE",
"licenseText": "Copyright (c) 2009 The Go Authors. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\n\n * Redistributions of source code must retain the above copyright\nnotice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above\ncopyright notice, this list of conditions and the following disclaimer\nin the documentation and/or other materials provided with the\ndistribution.\n * Neither the name of Google Inc. nor the names of its\ncontributors may be used to endorse or promote products derived from\nthis software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n"
},
{
"name": "golang.org/x/image",
"path": "golang.org/x/image/LICENSE",

4
go.mod
View file

@ -3,7 +3,7 @@ module code.gitea.io/gitea
go 1.22.5
require (
code.forgejo.org/f3/gof3/v3 v3.4.0
code.forgejo.org/f3/gof3/v3 v3.7.0
code.forgejo.org/forgejo/reply v1.0.2
code.gitea.io/actions-proto-go v0.4.0
code.gitea.io/gitea-vet v0.2.3
@ -95,7 +95,7 @@ require (
github.com/ulikunitz/xz v0.5.12
github.com/urfave/cli/v2 v2.27.2
github.com/valyala/fastjson v1.6.4
github.com/xanzy/go-gitlab v0.96.0
github.com/xanzy/go-gitlab v0.106.0
github.com/yohcop/openid-go v1.0.1
github.com/yuin/goldmark v1.7.4
github.com/yuin/goldmark-highlighting/v2 v2.0.0-20230729083705-37449abec8cc

8
go.sum
View file

@ -1,7 +1,7 @@
cloud.google.com/go/compute/metadata v0.3.0 h1:Tz+eQXMEqDIKRsmY3cHTL6FVaynIjX2QxYC4trgAKZc=
cloud.google.com/go/compute/metadata v0.3.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k=
code.forgejo.org/f3/gof3/v3 v3.4.0 h1:60LOo47tAKvr9nVu2qqNjbgRnCKeKx68mRMRBo/hIuA=
code.forgejo.org/f3/gof3/v3 v3.4.0/go.mod h1:9v7foN46KlEr5gywOSQPn1k5BVpPeuBozsLKlgOQ3YM=
code.forgejo.org/f3/gof3/v3 v3.7.0 h1:ZfuCP8CGm8ZJbWmL+V0pUu3E0X4FCAA7GfRDy/y5/K4=
code.forgejo.org/f3/gof3/v3 v3.7.0/go.mod h1:oNhOeqD4DZYjVcNjQXIOdDX9b/1tqxi9ITLS8H9/Csw=
code.forgejo.org/forgejo/archiver/v3 v3.5.1 h1:UmmbA7D5550uf71SQjarmrn6yKwOGxtEjb3jaYYtmSE=
code.forgejo.org/forgejo/archiver/v3 v3.5.1/go.mod h1:e3dqJ7H78uzsRSEACH1joayhuSyhnonssnDhppzS1L4=
code.forgejo.org/forgejo/reply v1.0.2 h1:dMhQCHV6/O3L5CLWNTol+dNzDAuyCK88z4J/lCdgFuQ=
@ -719,8 +719,8 @@ github.com/valyala/fastjson v1.6.4/go.mod h1:CLCAqky6SMuOcxStkYQvblddUtoRxhYMGLr
github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc=
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
github.com/xanzy/go-gitlab v0.96.0 h1:LGkZ+wSNMRtHIBaYE4Hq3dZVjprwHv3Y1+rhKU3WETs=
github.com/xanzy/go-gitlab v0.96.0/go.mod h1:ETg8tcj4OhrB84UEgeE8dSuV/0h4BBL1uOV/qK0vlyI=
github.com/xanzy/go-gitlab v0.106.0 h1:EDfD03K74cIlQo2EducfiupVrip+Oj02bq9ofw5F8sA=
github.com/xanzy/go-gitlab v0.106.0/go.mod h1:ETg8tcj4OhrB84UEgeE8dSuV/0h4BBL1uOV/qK0vlyI=
github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM=
github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw=
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=

View file

@ -87,7 +87,7 @@ func (o *asset) Get(ctx context.Context) bool {
node := o.GetNode()
o.Trace("%s", node.GetID())
id := f3_util.ParseInt(string(node.GetID()))
id := node.GetID().Int64()
asset, err := repo_model.GetAttachmentByID(ctx, id)
if repo_model.IsErrAttachmentNotExist(err) {
@ -154,7 +154,7 @@ func (o *asset) Put(ctx context.Context) generic.NodeID {
}
o.Trace("asset created %d", o.forgejoAsset.ID)
return generic.NodeID(fmt.Sprintf("%d", o.forgejoAsset.ID))
return generic.NewNodeID(o.forgejoAsset.ID)
}
func (o *asset) Delete(ctx context.Context) {

View file

@ -72,7 +72,7 @@ func (o *comment) Get(ctx context.Context) bool {
node := o.GetNode()
o.Trace("%s", node.GetID())
id := f3_util.ParseInt(string(node.GetID()))
id := node.GetID().Int64()
comment, err := issues_model.GetCommentByID(ctx, id)
if issues_model.IsErrCommentNotExist(err) {
@ -105,7 +105,7 @@ func (o *comment) Put(ctx context.Context) generic.NodeID {
panic(err)
}
o.Trace("comment created %d", o.forgejoComment.ID)
return generic.NodeID(fmt.Sprintf("%d", o.forgejoComment.ID))
return generic.NewNodeID(o.forgejoComment.ID)
}
func (o *comment) Delete(ctx context.Context) {

View file

@ -39,5 +39,5 @@ func (o *container) Patch(ctx context.Context) {
}
func (o *container) upsert(context.Context) generic.NodeID {
return generic.NodeID(o.getKind())
return generic.NewNodeID(o.getKind())
}

View file

@ -50,7 +50,7 @@ func (o *forge) getOwnersPath(ctx context.Context, id string) f3_tree.Path {
func (o *forge) Equals(context.Context, generic.NodeInterface) bool { return true }
func (o *forge) Get(context.Context) bool { return true }
func (o *forge) Put(context.Context) generic.NodeID { return generic.NodeID("forge") }
func (o *forge) Put(context.Context) generic.NodeID { return generic.NewNodeID("forge") }
func (o *forge) Patch(context.Context) {}
func (o *forge) Delete(context.Context) {}
func (o *forge) NewFormat() f3.Interface { return &f3.Forge{} }

View file

@ -96,7 +96,7 @@ func (o *issue) FromFormat(content f3.Interface) {
},
Content: issue.Content,
Milestone: milestone,
IsClosed: issue.State == "closed",
IsClosed: issue.State == f3.IssueStateClosed,
CreatedUnix: timeutil.TimeStamp(issue.Created.Unix()),
UpdatedUnix: timeutil.TimeStamp(issue.Updated.Unix()),
IsLocked: issue.IsLocked,
@ -124,7 +124,7 @@ func (o *issue) Get(ctx context.Context) bool {
o.Trace("%s", node.GetID())
project := f3_tree.GetProjectID(o.GetNode())
id := f3_util.ParseInt(string(node.GetID()))
id := node.GetID().Int64()
issue, err := issues_model.GetIssueByIndex(ctx, project, id)
if issues_model.IsErrIssueNotExist(err) {
@ -144,9 +144,9 @@ func (o *issue) Get(ctx context.Context) bool {
func (o *issue) Patch(ctx context.Context) {
node := o.GetNode()
project := f3_tree.GetProjectID(o.GetNode())
id := f3_util.ParseInt(string(node.GetID()))
id := node.GetID().Int64()
o.Trace("repo_id = %d, index = %d", project, id)
if _, err := db.GetEngine(ctx).Where("`repo_id` = ? AND `index` = ?", project, id).Cols("name", "content").Update(o.forgejoIssue); err != nil {
if _, err := db.GetEngine(ctx).Where("`repo_id` = ? AND `index` = ?", project, id).Cols("name", "content", "is_closed").Update(o.forgejoIssue); err != nil {
panic(fmt.Errorf("%v %v", o.forgejoIssue, err))
}
}
@ -207,7 +207,7 @@ func (o *issue) Put(ctx context.Context) generic.NodeID {
}
o.Trace("issue created %d/%d", o.forgejoIssue.ID, o.forgejoIssue.Index)
return generic.NodeID(fmt.Sprintf("%d", o.forgejoIssue.Index))
return generic.NewNodeID(o.forgejoIssue.Index)
}
func (o *issue) Delete(ctx context.Context) {

View file

@ -65,7 +65,7 @@ func (o *label) Get(ctx context.Context) bool {
o.Trace("%s", node.GetID())
project := f3_tree.GetProjectID(o.GetNode())
id := f3_util.ParseInt(string(node.GetID()))
id := node.GetID().Int64()
label, err := issues_model.GetLabelInRepoByID(ctx, project, id)
if issues_model.IsErrRepoLabelNotExist(err) {
@ -80,7 +80,7 @@ func (o *label) Get(ctx context.Context) bool {
func (o *label) Patch(ctx context.Context) {
o.Trace("%d", o.forgejoLabel.ID)
if _, err := db.GetEngine(ctx).ID(o.forgejoLabel.ID).Cols("name", "description").Update(o.forgejoLabel); err != nil {
if _, err := db.GetEngine(ctx).ID(o.forgejoLabel.ID).Cols("name", "description", "color").Update(o.forgejoLabel); err != nil {
panic(fmt.Errorf("UpdateLabelCols: %v %v", o.forgejoLabel, err))
}
}
@ -94,7 +94,7 @@ func (o *label) Put(ctx context.Context) generic.NodeID {
panic(err)
}
o.Trace("label created %d", o.forgejoLabel.ID)
return generic.NodeID(fmt.Sprintf("%d", o.forgejoLabel.ID))
return generic.NewNodeID(o.forgejoLabel.ID)
}
func (o *label) Delete(ctx context.Context) {

View file

@ -89,7 +89,7 @@ func (o *milestone) FromFormat(content f3.Interface) {
ID: f3_util.ParseInt(milestone.GetID()),
Name: milestone.Title,
Content: milestone.Description,
IsClosed: milestone.State == "closed",
IsClosed: milestone.State == f3.MilestoneStateClosed,
CreatedUnix: timeutil.TimeStamp(milestone.Created.Unix()),
UpdatedUnix: timeutil.TimeStamp(milestone.Updated.Unix()),
ClosedDateUnix: closed,
@ -102,7 +102,7 @@ func (o *milestone) Get(ctx context.Context) bool {
o.Trace("%s", node.GetID())
project := f3_tree.GetProjectID(o.GetNode())
id := f3_util.ParseInt(string(node.GetID()))
id := node.GetID().Int64()
milestone, err := issues_model.GetMilestoneByRepoID(ctx, project, id)
if issues_model.IsErrMilestoneNotExist(err) {
@ -131,7 +131,7 @@ func (o *milestone) Put(ctx context.Context) generic.NodeID {
panic(err)
}
o.Trace("milestone created %d", o.forgejoMilestone.ID)
return generic.NodeID(fmt.Sprintf("%d", o.forgejoMilestone.ID))
return generic.NewNodeID(o.forgejoMilestone.ID)
}
func (o *milestone) Delete(ctx context.Context) {

View file

@ -62,7 +62,7 @@ func (o *organization) FromFormat(content f3.Interface) {
func (o *organization) Get(ctx context.Context) bool {
node := o.GetNode()
o.Trace("%s", node.GetID())
id := f3_util.ParseInt(string(node.GetID()))
id := node.GetID().Int64()
organization, err := org_model.GetOrgByID(ctx, id)
if user_model.IsErrUserNotExist(err) {
return false
@ -94,7 +94,7 @@ func (o *organization) Put(ctx context.Context) generic.NodeID {
panic(err)
}
return generic.NodeID(fmt.Sprintf("%d", o.forgejoOrganization.ID))
return generic.NewNodeID(o.forgejoOrganization.ID)
}
func (o *organization) Delete(ctx context.Context) {

View file

@ -42,7 +42,7 @@ func (o *organizations) GetIDFromName(ctx context.Context, name string) generic.
panic(fmt.Errorf("GetOrganizationByName: %v", err))
}
return generic.NodeID(fmt.Sprintf("%d", organization.ID))
return generic.NewNodeID(organization.ID)
}
func newOrganizations() generic.NodeDriverInterface {

View file

@ -96,7 +96,7 @@ func (o *project) FromFormat(content f3.Interface) {
func (o *project) Get(ctx context.Context) bool {
node := o.GetNode()
o.Trace("%s", node.GetID())
id := f3_util.ParseInt(string(node.GetID()))
id := node.GetID().Int64()
u, err := repo_model.GetRepositoryByID(ctx, id)
if repo_model.IsErrRepoNotExist(err) {
return false
@ -166,7 +166,7 @@ func (o *project) Put(ctx context.Context) generic.NodeID {
o.forgejoProject = repo
o.Trace("project created %d", o.forgejoProject.ID)
}
return generic.NodeID(fmt.Sprintf("%d", o.forgejoProject.ID))
return generic.NewNodeID(o.forgejoProject.ID)
}
func (o *project) Delete(ctx context.Context) {

View file

@ -13,7 +13,6 @@ import (
f3_tree "code.forgejo.org/f3/gof3/v3/tree/f3"
"code.forgejo.org/f3/gof3/v3/tree/generic"
f3_util "code.forgejo.org/f3/gof3/v3/util"
)
type projects struct {
@ -31,7 +30,7 @@ func (o *projects) GetIDFromName(ctx context.Context, name string) generic.NodeI
panic(fmt.Errorf("error GetRepositoryByOwnerAndName(%s, %s): %v", owner, name, err))
}
return generic.NodeID(fmt.Sprintf("%d", forgejoProject.ID))
return generic.NewNodeID(forgejoProject.ID)
}
func (o *projects) ListPage(ctx context.Context, page int) generic.ChildrenSlice {
@ -41,7 +40,7 @@ func (o *projects) ListPage(ctx context.Context, page int) generic.ChildrenSlice
forgejoProjects, _, err := repo_model.SearchRepository(ctx, &repo_model.SearchRepoOptions{
ListOptions: db.ListOptions{Page: page, PageSize: pageSize},
OwnerID: f3_util.ParseInt(string(owner.GetID())),
OwnerID: owner.GetID().Int64(),
Private: true,
})
if err != nil {

View file

@ -51,7 +51,7 @@ func (o *pullRequest) repositoryToReference(ctx context.Context, repository *rep
if repository == nil {
panic("unexpected nil repository")
}
forge := o.getTree().GetRoot().GetChild(f3_tree.KindForge).GetDriver().(*forge)
forge := o.getTree().GetRoot().GetChild(generic.NewNodeID(f3_tree.KindForge)).GetDriver().(*forge)
owners := forge.getOwnersPath(ctx, fmt.Sprintf("%d", repository.OwnerID))
return f3_tree.NewRepositoryReference(owners.String(), repository.OwnerID, repository.ID)
}
@ -172,7 +172,7 @@ func (o *pullRequest) FromFormat(content f3.Interface) {
Title: pullRequest.Title,
Content: pullRequest.Content,
Milestone: milestone,
IsClosed: pullRequest.State == "closed",
IsClosed: pullRequest.State == f3.PullRequestStateClosed,
CreatedUnix: timeutil.TimeStamp(pullRequest.Created.Unix()),
UpdatedUnix: timeutil.TimeStamp(pullRequest.Updated.Unix()),
IsLocked: pullRequest.IsLocked,
@ -190,7 +190,7 @@ func (o *pullRequest) Get(ctx context.Context) bool {
o.Trace("%s", node.GetID())
project := f3_tree.GetProjectID(o.GetNode())
id := f3_util.ParseInt(string(node.GetID()))
id := node.GetID().Int64()
issue, err := issues_model.GetIssueByIndex(ctx, project, id)
if issues_model.IsErrIssueNotExist(err) {
@ -219,7 +219,7 @@ func (o *pullRequest) Get(ctx context.Context) bool {
func (o *pullRequest) Patch(ctx context.Context) {
node := o.GetNode()
project := f3_tree.GetProjectID(o.GetNode())
id := f3_util.ParseInt(string(node.GetID()))
id := node.GetID().Int64()
o.Trace("repo_id = %d, index = %d", project, id)
if _, err := db.GetEngine(ctx).Where("`repo_id` = ? AND `index` = ?", project, id).Cols("name", "content").Update(o.forgejoPullRequest); err != nil {
panic(fmt.Errorf("%v %v", o.forgejoPullRequest, err))
@ -289,7 +289,7 @@ func (o *pullRequest) Put(ctx context.Context) generic.NodeID {
}
o.Trace("pullRequest created %d/%d", o.forgejoPullRequest.ID, o.forgejoPullRequest.Index)
return generic.NodeID(fmt.Sprintf("%d", o.forgejoPullRequest.Index))
return generic.NewNodeID(o.forgejoPullRequest.Index)
}
func (o *pullRequest) Delete(ctx context.Context) {

View file

@ -67,7 +67,7 @@ func (o *reaction) Get(ctx context.Context) bool {
node := o.GetNode()
o.Trace("%s", node.GetID())
id := f3_util.ParseInt(string(node.GetID()))
id := node.GetID().Int64()
if has, err := db.GetEngine(ctx).Where("ID = ?", id).Get(o.forgejoReaction); err != nil {
panic(fmt.Errorf("reaction %v %w", id, err))
@ -115,7 +115,7 @@ func (o *reaction) Put(ctx context.Context) generic.NodeID {
panic(err)
}
o.Trace("reaction created %d", o.forgejoReaction.ID)
return generic.NodeID(fmt.Sprintf("%d", o.forgejoReaction.ID))
return generic.NewNodeID(o.forgejoReaction.ID)
}
func (o *reaction) Delete(ctx context.Context) {

View file

@ -85,7 +85,7 @@ func (o *release) Get(ctx context.Context) bool {
node := o.GetNode()
o.Trace("%s", node.GetID())
id := f3_util.ParseInt(string(node.GetID()))
id := node.GetID().Int64()
release, err := repo_model.GetReleaseByID(ctx, id)
if repo_model.IsErrReleaseNotExist(err) {
@ -133,7 +133,7 @@ func (o *release) Put(ctx context.Context) generic.NodeID {
panic(err)
}
o.Trace("release created %d", o.forgejoRelease.ID)
return generic.NodeID(fmt.Sprintf("%d", o.forgejoRelease.ID))
return generic.NewNodeID(o.forgejoRelease.ID)
}
func (o *release) Delete(ctx context.Context) {

View file

@ -68,7 +68,7 @@ func (o *repository) Patch(ctx context.Context) {
func (o *repository) upsert(ctx context.Context) generic.NodeID {
o.Trace("%s", o.GetNativeID())
o.h.Upsert(ctx, o.f)
return generic.NodeID(o.f.Name)
return generic.NewNodeID(o.f.Name)
}
func (o *repository) SetFetchFunc(fetchFunc func(ctx context.Context, destination string)) {

View file

@ -111,7 +111,7 @@ func (o *review) Get(ctx context.Context) bool {
node := o.GetNode()
o.Trace("%s", node.GetID())
id := f3_util.ParseInt(string(node.GetID()))
id := node.GetID().Int64()
review, err := issues_model.GetReviewByID(ctx, id)
if issues_model.IsErrReviewNotExist(err) {
@ -153,7 +153,7 @@ func (o *review) Put(ctx context.Context) generic.NodeID {
panic(err)
}
o.Trace("review created %d", o.forgejoReview.ID)
return generic.NodeID(fmt.Sprintf("%d", o.forgejoReview.ID))
return generic.NewNodeID(o.forgejoReview.ID)
}
func (o *review) Delete(ctx context.Context) {

View file

@ -92,7 +92,7 @@ func (o *reviewComment) Get(ctx context.Context) bool {
node := o.GetNode()
o.Trace("%s", node.GetID())
id := f3_util.ParseInt(string(node.GetID()))
id := node.GetID().Int64()
reviewComment, err := issues_model.GetCommentByID(ctx, id)
if issues_model.IsErrCommentNotExist(err) {
@ -125,7 +125,7 @@ func (o *reviewComment) Put(ctx context.Context) generic.NodeID {
panic(err)
}
o.Trace("reviewComment created %d", o.forgejoReviewComment.ID)
return generic.NodeID(fmt.Sprintf("%d", o.forgejoReviewComment.ID))
return generic.NewNodeID(o.forgejoReviewComment.ID)
}
func (o *reviewComment) Delete(ctx context.Context) {

View file

@ -61,7 +61,7 @@ func (o *topic) Get(ctx context.Context) bool {
node := o.GetNode()
o.Trace("%s", node.GetID())
id := f3_util.ParseInt(string(node.GetID()))
id := node.GetID().Int64()
if has, err := db.GetEngine(ctx).Where("ID = ?", id).Get(o.forgejoTopic); err != nil {
panic(fmt.Errorf("topic %v %w", id, err))
@ -86,7 +86,7 @@ func (o *topic) Put(ctx context.Context) generic.NodeID {
panic(err)
}
o.Trace("topic created %d", o.forgejoTopic.ID)
return generic.NodeID(fmt.Sprintf("%d", o.forgejoTopic.ID))
return generic.NewNodeID(o.forgejoTopic.ID)
}
func (o *topic) Delete(ctx context.Context) {

View file

@ -81,7 +81,7 @@ func (o *user) FromFormat(content f3.Interface) {
func (o *user) Get(ctx context.Context) bool {
node := o.GetNode()
o.Trace("%s", node.GetID())
id := f3_util.ParseInt(string(node.GetID()))
id := node.GetID().Int64()
u, err := user_model.GetPossibleUserByID(ctx, id)
if user_model.IsErrUserNotExist(err) {
return false
@ -98,7 +98,7 @@ func (o *user) Patch(context.Context) {
func (o *user) Put(ctx context.Context) generic.NodeID {
if user := getSystemUserByName(o.forgejoUser.Name); user != nil {
return generic.NodeID(fmt.Sprintf("%d", user.ID))
return generic.NewNodeID(user.ID)
}
o.forgejoUser.LowerName = strings.ToLower(o.forgejoUser.Name)
@ -111,7 +111,7 @@ func (o *user) Put(ctx context.Context) generic.NodeID {
panic(err)
}
return generic.NodeID(fmt.Sprintf("%d", o.forgejoUser.ID))
return generic.NewNodeID(o.forgejoUser.ID)
}
func (o *user) Delete(ctx context.Context) {

View file

@ -40,7 +40,7 @@ func (o *users) GetIDFromName(ctx context.Context, name string) generic.NodeID {
panic(fmt.Errorf("GetUserByName: %v", err))
}
return generic.NodeID(fmt.Sprintf("%d", user.ID))
return generic.NewNodeID(user.ID)
}
func newUsers() generic.NodeDriverInterface {