Format & remove old todos

This commit is contained in:
Michael Jerger 2024-05-24 08:49:08 +02:00
parent 30e2582f24
commit 64be24ed0c
5 changed files with 25 additions and 31 deletions

View file

@ -138,8 +138,6 @@ type Repository struct {
OriginalURL string `xorm:"VARCHAR(2048)"` OriginalURL string `xorm:"VARCHAR(2048)"`
DefaultBranch string DefaultBranch string
WikiBranch string WikiBranch string
// TODO: Do we still need this here?
FederationRepos string `xorm:"TEXT"`
NumWatches int NumWatches int
NumStars int NumStars int
@ -346,10 +344,8 @@ func (repo *Repository) APIURL() string {
} }
// APActorID returns the activitypub repository API URL // APActorID returns the activitypub repository API URL
// TODO: At least camel case?
// TODO: Mv federation related stuff to federated_repo // TODO: Mv federation related stuff to federated_repo
func (repo *Repository) APActorID() string { func (repo *Repository) APActorID() string {
// TODO: use spintf instead of concat - might mitigate injections
return fmt.Sprintf("%vapi/v1/activitypub/repository-id/%v", setting.AppURL, url.PathEscape(fmt.Sprint(repo.ID))) return fmt.Sprintf("%vapi/v1/activitypub/repository-id/%v", setting.AppURL, url.PathEscape(fmt.Sprint(repo.ID)))
} }

View file

@ -1,6 +1,5 @@
// Copyright 2024 The Forgejo Authors. All rights reserved. // Copyright 2024 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// ToDo: Is this package the right place for federated repo? May need to diskuss this.
package repo package repo
import ( import (

View file

@ -1,5 +1,4 @@
// Copyright 2016 The Gitea Authors. All rights reserved. // Copyright 2016 The Gitea Authors. All rights reserved.
// Copyright 2024 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
package repo package repo
@ -24,6 +23,7 @@ func init() {
db.RegisterModel(new(Star)) db.RegisterModel(new(Star))
} }
// StarRepo or unstar repository.
func StarRepo(ctx context.Context, userID, repoID int64, star bool) error { func StarRepo(ctx context.Context, userID, repoID int64, star bool) error {
ctx, committer, err := db.TxContext(ctx) ctx, committer, err := db.TxContext(ctx)
if err != nil { if err != nil {

View file

@ -114,7 +114,6 @@ type RepoSettingForm struct {
RepoName string `binding:"Required;AlphaDashDot;MaxSize(100)"` RepoName string `binding:"Required;AlphaDashDot;MaxSize(100)"`
Description string `binding:"MaxSize(2048)"` Description string `binding:"MaxSize(2048)"`
Website string `binding:"ValidUrl;MaxSize(1024)"` Website string `binding:"ValidUrl;MaxSize(1024)"`
// ToDo: Refactor in template and i18n labels to Following Repos
FederationRepos string FederationRepos string
Interval string Interval string
MirrorAddress string MirrorAddress string