From 64be24ed0ce158119d2cdaee0b1244e7ac0367aa Mon Sep 17 00:00:00 2001
From: Michael Jerger <michael.jerger@meissa-gmbh.de>
Date: Fri, 24 May 2024 08:49:08 +0200
Subject: [PATCH] Format & remove old todos

---
 models/repo/repo.go                  |  4 ---
 models/repo/repo_repository.go       |  1 -
 models/repo/star.go                  |  2 +-
 services/forms/repo_form.go          |  7 ++---
 templates/repo/settings/options.tmpl | 42 ++++++++++++++--------------
 5 files changed, 25 insertions(+), 31 deletions(-)

diff --git a/models/repo/repo.go b/models/repo/repo.go
index 3a4f878a7c..2e1dffa4f7 100644
--- a/models/repo/repo.go
+++ b/models/repo/repo.go
@@ -138,8 +138,6 @@ type Repository struct {
 	OriginalURL         string             `xorm:"VARCHAR(2048)"`
 	DefaultBranch       string
 	WikiBranch          string
-	// TODO: Do we still need this here?
-	FederationRepos string `xorm:"TEXT"`
 
 	NumWatches          int
 	NumStars            int
@@ -346,10 +344,8 @@ func (repo *Repository) APIURL() string {
 }
 
 // APActorID returns the activitypub repository API URL
-// TODO: At least camel case?
 // TODO: Mv federation related stuff to federated_repo
 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)))
 }
 
diff --git a/models/repo/repo_repository.go b/models/repo/repo_repository.go
index 8f62e82122..6780165a38 100644
--- a/models/repo/repo_repository.go
+++ b/models/repo/repo_repository.go
@@ -1,6 +1,5 @@
 // Copyright 2024 The Forgejo Authors. All rights reserved.
 // SPDX-License-Identifier: MIT
-// ToDo: Is this package the right place for federated repo? May need to diskuss this.
 package repo
 
 import (
diff --git a/models/repo/star.go b/models/repo/star.go
index dda6ff14e2..60737149da 100644
--- a/models/repo/star.go
+++ b/models/repo/star.go
@@ -1,5 +1,4 @@
 // Copyright 2016 The Gitea Authors. All rights reserved.
-// Copyright 2024 The Forgejo Authors. All rights reserved.
 // SPDX-License-Identifier: MIT
 
 package repo
@@ -24,6 +23,7 @@ func init() {
 	db.RegisterModel(new(Star))
 }
 
+// StarRepo or unstar repository.
 func StarRepo(ctx context.Context, userID, repoID int64, star bool) error {
 	ctx, committer, err := db.TxContext(ctx)
 	if err != nil {
diff --git a/services/forms/repo_form.go b/services/forms/repo_form.go
index ff758c9254..1bc06b1b9a 100644
--- a/services/forms/repo_form.go
+++ b/services/forms/repo_form.go
@@ -111,10 +111,9 @@ func ParseRemoteAddr(remoteAddr, authUsername, authPassword string) (string, err
 
 // RepoSettingForm form for changing repository settings
 type RepoSettingForm struct {
-	RepoName    string `binding:"Required;AlphaDashDot;MaxSize(100)"`
-	Description string `binding:"MaxSize(2048)"`
-	Website     string `binding:"ValidUrl;MaxSize(1024)"`
-	// ToDo: Refactor in template and i18n labels to Following Repos
+	RepoName               string `binding:"Required;AlphaDashDot;MaxSize(100)"`
+	Description            string `binding:"MaxSize(2048)"`
+	Website                string `binding:"ValidUrl;MaxSize(1024)"`
 	FederationRepos        string
 	Interval               string
 	MirrorAddress          string
diff --git a/templates/repo/settings/options.tmpl b/templates/repo/settings/options.tmpl
index f1adffcad2..52d0847b55 100644
--- a/templates/repo/settings/options.tmpl
+++ b/templates/repo/settings/options.tmpl
@@ -63,27 +63,27 @@
 			</form>
 		</div>
 
-	{{if FederationEnabled}}
-		<h4 class="ui top attached header">
-			{{ctx.Locale.Tr "repo.settings.federation_settings"}}
-		</h4>
-		<div class="ui attached segment">
-			<form class="ui form" method="post">
-				{{.CsrfTokenHtml}}
-				<input type="hidden" name="action" value="federation">
-				<div class="field {{if .Err_FollowingRepos}}error{{end}}">
-					<p>{{ctx.Locale.Tr "repo.settings.federation_apapiurl"}}</p>
-					<p><b>{{.RepositoryAPActorID}}</b></p>
-					<div class="divider"></div>
-					<label for="following_repos">{{ctx.Locale.Tr "repo.settings.federation_following_repos"}}</label>
-					<input id="following_repos" name="federation_repos" value="{{.FollowingRepos}}">
-				</div>
-				<div class="field">
-					<button class="ui primary button">{{ctx.Locale.Tr "repo.settings.update_settings"}}</button>
-				</div>
-			</form>
-		</div>
-	{{end}}
+		{{if FederationEnabled}}
+			<h4 class="ui top attached header">
+				{{ctx.Locale.Tr "repo.settings.federation_settings"}}
+			</h4>
+			<div class="ui attached segment">
+				<form class="ui form" method="post">
+					{{.CsrfTokenHtml}}
+					<input type="hidden" name="action" value="federation">
+					<div class="field {{if .Err_FollowingRepos}}error{{end}}">
+						<p>{{ctx.Locale.Tr "repo.settings.federation_apapiurl"}}</p>
+						<p><b>{{.RepositoryAPActorID}}</b></p>
+						<div class="divider"></div>
+						<label for="following_repos">{{ctx.Locale.Tr "repo.settings.federation_following_repos"}}</label>
+						<input id="following_repos" name="federation_repos" value="{{.FollowingRepos}}">
+					</div>
+					<div class="field">
+						<button class="ui primary button">{{ctx.Locale.Tr "repo.settings.update_settings"}}</button>
+					</div>
+				</form>
+			</div>
+		{{end}}
 
 		{{/* These variables exist to make the logic in the Settings window easier to comprehend and are not used later on. */}}
 		{{$newMirrorsPartiallyEnabled := or (not .DisableNewPullMirrors) (not .DisableNewPushMirrors)}}