From 72247b8d4988fe108396f28dc559f277abed8859 Mon Sep 17 00:00:00 2001 From: Anthony Wang Date: Thu, 12 Jan 2023 21:48:05 +0000 Subject: [PATCH] Fix lint errors --- modules/forgefed/branch.go | 2 +- modules/forgefed/commit.go | 2 +- modules/forgefed/forgefed.go | 2 +- modules/forgefed/push.go | 2 +- modules/forgefed/repository.go | 2 +- modules/forgefed/repository_test.go | 2 +- modules/forgefed/ticket.go | 2 +- routers/api/v1/activitypub/authorize_interaction.go | 2 +- routers/api/v1/activitypub/create.go | 7 +++---- routers/api/v1/activitypub/delete.go | 5 ++--- routers/api/v1/activitypub/follow.go | 2 +- routers/api/v1/activitypub/note.go | 2 +- routers/api/v1/activitypub/person.go | 4 ++-- routers/api/v1/activitypub/repo.go | 2 +- routers/api/v1/activitypub/reqsignature.go | 2 +- routers/api/v1/activitypub/response.go | 2 +- routers/api/v1/activitypub/star.go | 2 +- routers/api/v1/activitypub/ticket.go | 2 +- services/activitypub/activities.go | 2 +- services/activitypub/client.go | 2 +- services/activitypub/client_test.go | 2 +- services/activitypub/iri.go | 2 +- services/activitypub/objects.go | 2 +- services/activitypub/transport.go | 2 +- services/activitypub/webfinger.go | 5 ++++- 25 files changed, 32 insertions(+), 31 deletions(-) diff --git a/modules/forgefed/branch.go b/modules/forgefed/branch.go index 00a2c13764..5e20b6ef45 100644 --- a/modules/forgefed/branch.go +++ b/modules/forgefed/branch.go @@ -1,4 +1,4 @@ -// Copyright 2022 The Gitea Authors. All rights reserved. +// Copyright 2023 The Forgejo Authors. All rights reserved. // SPDX-License-Identifier: MIT package forgefed diff --git a/modules/forgefed/commit.go b/modules/forgefed/commit.go index ed9821a2c9..b8c0bf3eb7 100644 --- a/modules/forgefed/commit.go +++ b/modules/forgefed/commit.go @@ -1,4 +1,4 @@ -// Copyright 2022 The Gitea Authors. All rights reserved. +// Copyright 2023 The Forgejo Authors. All rights reserved. // SPDX-License-Identifier: MIT package forgefed diff --git a/modules/forgefed/forgefed.go b/modules/forgefed/forgefed.go index b6901956b6..4dc9eaf22c 100644 --- a/modules/forgefed/forgefed.go +++ b/modules/forgefed/forgefed.go @@ -1,4 +1,4 @@ -// Copyright 2022 The Gitea Authors. All rights reserved. +// Copyright 2023 The Forgejo Authors. All rights reserved. // SPDX-License-Identifier: MIT package forgefed diff --git a/modules/forgefed/push.go b/modules/forgefed/push.go index 065e9d7736..9881aac494 100644 --- a/modules/forgefed/push.go +++ b/modules/forgefed/push.go @@ -1,4 +1,4 @@ -// Copyright 2022 The Gitea Authors. All rights reserved. +// Copyright 2023 The Forgejo Authors. All rights reserved. // SPDX-License-Identifier: MIT package forgefed diff --git a/modules/forgefed/repository.go b/modules/forgefed/repository.go index f0356b6af2..71701d9f3b 100644 --- a/modules/forgefed/repository.go +++ b/modules/forgefed/repository.go @@ -1,4 +1,4 @@ -// Copyright 2022 The Gitea Authors. All rights reserved. +// Copyright 2023 The Forgejo Authors. All rights reserved. // SPDX-License-Identifier: MIT package forgefed diff --git a/modules/forgefed/repository_test.go b/modules/forgefed/repository_test.go index 443318c98b..d623f124cf 100644 --- a/modules/forgefed/repository_test.go +++ b/modules/forgefed/repository_test.go @@ -1,4 +1,4 @@ -// Copyright 2022 The Gitea Authors. All rights reserved. +// Copyright 2023 The Forgejo Authors. All rights reserved. // SPDX-License-Identifier: MIT package forgefed diff --git a/modules/forgefed/ticket.go b/modules/forgefed/ticket.go index da4a9ee70d..be2607001b 100644 --- a/modules/forgefed/ticket.go +++ b/modules/forgefed/ticket.go @@ -1,4 +1,4 @@ -// Copyright 2022 The Gitea Authors. All rights reserved. +// Copyright 2023 The Forgejo Authors. All rights reserved. // SPDX-License-Identifier: MIT package forgefed diff --git a/routers/api/v1/activitypub/authorize_interaction.go b/routers/api/v1/activitypub/authorize_interaction.go index b8f2bd49ec..1b89689d06 100644 --- a/routers/api/v1/activitypub/authorize_interaction.go +++ b/routers/api/v1/activitypub/authorize_interaction.go @@ -1,4 +1,4 @@ -// Copyright 2022 The Gitea Authors. All rights reserved. +// Copyright 2023 The Forgejo Authors. All rights reserved. // SPDX-License-Identifier: MIT package activitypub diff --git a/routers/api/v1/activitypub/create.go b/routers/api/v1/activitypub/create.go index abf5ff402f..29c63147b2 100644 --- a/routers/api/v1/activitypub/create.go +++ b/routers/api/v1/activitypub/create.go @@ -1,11 +1,10 @@ -// Copyright 2022 The Gitea Authors. All rights reserved. +// Copyright 2023 The Forgejo Authors. All rights reserved. // SPDX-License-Identifier: MIT package activitypub import ( "context" - "encoding/json" "errors" "net/url" "strconv" @@ -16,6 +15,7 @@ import ( repo_model "code.gitea.io/gitea/models/repo" user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/forgefed" + "code.gitea.io/gitea/modules/json" repo_module "code.gitea.io/gitea/modules/repository" "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/services/activitypub" @@ -27,7 +27,6 @@ import ( ap "github.com/go-ap/activitypub" ) - // Create a new federated user from a Person object func createPerson(ctx context.Context, person *ap.Person) error { _, err := user_model.GetUserByIRI(ctx, person.GetLink().String()) @@ -94,7 +93,7 @@ func createPerson(ctx context.Context, person *ap.Person) error { if err != nil { return err } - + if person.Icon != nil { // Fetch and save user icon icon, err := ap.ToObject(person.Icon) diff --git a/routers/api/v1/activitypub/delete.go b/routers/api/v1/activitypub/delete.go index 48c63d1b2c..c32fe3bd5e 100644 --- a/routers/api/v1/activitypub/delete.go +++ b/routers/api/v1/activitypub/delete.go @@ -1,4 +1,4 @@ -// Copyright 2022 The Gitea Authors. All rights reserved. +// Copyright 2023 The Forgejo Authors. All rights reserved. // SPDX-License-Identifier: MIT package activitypub @@ -26,6 +26,5 @@ func delete(ctx context.Context, delete ap.Delete) error { if err != nil { return err } - user_service.DeleteUser(ctx, objectUser, true) - return nil + return user_service.DeleteUser(ctx, objectUser, true) } diff --git a/routers/api/v1/activitypub/follow.go b/routers/api/v1/activitypub/follow.go index 68afc49bce..2badcaf8f0 100644 --- a/routers/api/v1/activitypub/follow.go +++ b/routers/api/v1/activitypub/follow.go @@ -1,4 +1,4 @@ -// Copyright 2022 The Gitea Authors. All rights reserved. +// Copyright 2023 The Forgejo Authors. All rights reserved. // SPDX-License-Identifier: MIT package activitypub diff --git a/routers/api/v1/activitypub/note.go b/routers/api/v1/activitypub/note.go index 897206c804..8e86e4a7cd 100644 --- a/routers/api/v1/activitypub/note.go +++ b/routers/api/v1/activitypub/note.go @@ -1,4 +1,4 @@ -// Copyright 2022 The Gitea Authors. All rights reserved. +// Copyright 2023 The Forgejo Authors. All rights reserved. // SPDX-License-Identifier: MIT package activitypub diff --git a/routers/api/v1/activitypub/person.go b/routers/api/v1/activitypub/person.go index b4cb28576d..e0a0dd4028 100644 --- a/routers/api/v1/activitypub/person.go +++ b/routers/api/v1/activitypub/person.go @@ -1,4 +1,4 @@ -// Copyright 2022 The Gitea Authors. All rights reserved. +// Copyright 2023 The Forgejo Authors. All rights reserved. // SPDX-License-Identifier: MIT package activitypub @@ -140,7 +140,7 @@ func PersonInbox(ctx *context.APIContext) { }) case ap.DeleteType: // Deleting a user - delete(ctx, activity) + err = delete(ctx, activity) default: err = fmt.Errorf("unsupported ActivityStreams activity type: %s", activity.GetType()) } diff --git a/routers/api/v1/activitypub/repo.go b/routers/api/v1/activitypub/repo.go index f1b6a11963..5d66dd5a9f 100644 --- a/routers/api/v1/activitypub/repo.go +++ b/routers/api/v1/activitypub/repo.go @@ -1,4 +1,4 @@ -// Copyright 2022 The Gitea Authors. All rights reserved. +// Copyright 2023 The Forgejo Authors. All rights reserved. // SPDX-License-Identifier: MIT package activitypub diff --git a/routers/api/v1/activitypub/reqsignature.go b/routers/api/v1/activitypub/reqsignature.go index 138d8a88eb..aeef708b7b 100644 --- a/routers/api/v1/activitypub/reqsignature.go +++ b/routers/api/v1/activitypub/reqsignature.go @@ -1,4 +1,4 @@ -// Copyright 2022 The Gitea Authors. All rights reserved. +// Copyright 2023 The Forgejo Authors. All rights reserved. // SPDX-License-Identifier: MIT package activitypub diff --git a/routers/api/v1/activitypub/response.go b/routers/api/v1/activitypub/response.go index b76308bdd3..6a1ab3374a 100644 --- a/routers/api/v1/activitypub/response.go +++ b/routers/api/v1/activitypub/response.go @@ -1,4 +1,4 @@ -// Copyright 2022 The Gitea Authors. All rights reserved. +// Copyright 2023 The Forgejo Authors. All rights reserved. // SPDX-License-Identifier: MIT package activitypub diff --git a/routers/api/v1/activitypub/star.go b/routers/api/v1/activitypub/star.go index a6d58c41ea..2da4639228 100644 --- a/routers/api/v1/activitypub/star.go +++ b/routers/api/v1/activitypub/star.go @@ -1,4 +1,4 @@ -// Copyright 2022 The Gitea Authors. All rights reserved. +// Copyright 2023 The Forgejo Authors. All rights reserved. // SPDX-License-Identifier: MIT package activitypub diff --git a/routers/api/v1/activitypub/ticket.go b/routers/api/v1/activitypub/ticket.go index 75fc93ac05..8f2cfc6e6f 100644 --- a/routers/api/v1/activitypub/ticket.go +++ b/routers/api/v1/activitypub/ticket.go @@ -1,4 +1,4 @@ -// Copyright 2022 The Gitea Authors. All rights reserved. +// Copyright 2023 The Forgejo Authors. All rights reserved. // SPDX-License-Identifier: MIT package activitypub diff --git a/services/activitypub/activities.go b/services/activitypub/activities.go index f2835a28e7..c684a19783 100644 --- a/services/activitypub/activities.go +++ b/services/activitypub/activities.go @@ -1,4 +1,4 @@ -// Copyright 2022 The Gitea Authors. All rights reserved. +// Copyright 2023 The Forgejo Authors. All rights reserved. // SPDX-License-Identifier: MIT package activitypub diff --git a/services/activitypub/client.go b/services/activitypub/client.go index ed5c9990d6..9fb5ba448c 100644 --- a/services/activitypub/client.go +++ b/services/activitypub/client.go @@ -1,4 +1,4 @@ -// Copyright 2022 The Gitea Authors. All rights reserved. +// Copyright 2023 The Forgejo Authors. All rights reserved. // SPDX-License-Identifier: MIT package activitypub diff --git a/services/activitypub/client_test.go b/services/activitypub/client_test.go index 0ab512c5ba..8438c20a60 100644 --- a/services/activitypub/client_test.go +++ b/services/activitypub/client_test.go @@ -1,4 +1,4 @@ -// Copyright 2022 The Gitea Authors. All rights reserved. +// Copyright 2023 The Forgejo Authors. All rights reserved. // SPDX-License-Identifier: MIT package activitypub diff --git a/services/activitypub/iri.go b/services/activitypub/iri.go index 468b13fb39..9430d2c799 100644 --- a/services/activitypub/iri.go +++ b/services/activitypub/iri.go @@ -1,4 +1,4 @@ -// Copyright 2022 The Gitea Authors. All rights reserved. +// Copyright 2023 The Forgejo Authors. All rights reserved. // SPDX-License-Identifier: MIT package activitypub diff --git a/services/activitypub/objects.go b/services/activitypub/objects.go index ed58e1feee..8a1ec9f1cf 100644 --- a/services/activitypub/objects.go +++ b/services/activitypub/objects.go @@ -1,4 +1,4 @@ -// Copyright 2022 The Gitea Authors. All rights reserved. +// Copyright 2023 The Forgejo Authors. All rights reserved. // SPDX-License-Identifier: MIT package activitypub diff --git a/services/activitypub/transport.go b/services/activitypub/transport.go index 10e5a4cdbc..c349daa3e3 100644 --- a/services/activitypub/transport.go +++ b/services/activitypub/transport.go @@ -1,4 +1,4 @@ -// Copyright 2022 The Gitea Authors. All rights reserved. +// Copyright 2023 The Forgejo Authors. All rights reserved. // SPDX-License-Identifier: MIT package activitypub diff --git a/services/activitypub/webfinger.go b/services/activitypub/webfinger.go index 9f690daddc..e9183be627 100644 --- a/services/activitypub/webfinger.go +++ b/services/activitypub/webfinger.go @@ -1,4 +1,7 @@ -package activitypub; +// Copyright 2023 The Forgejo Authors. All rights reserved. +// SPDX-License-Identifier: MIT + +package activitypub type WebfingerJRD struct { Subject string `json:"subject,omitempty"`