Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-22 09:54:24 +01:00

Rename to StoreFederatedRepo*

This commit is contained in:
erik 2024-03-25 16:35:35 +01:00
parent ca7d1c6f78
commit 35d3fc199c
3 changed files with 4 additions and 5 deletions

View file

@ -24,8 +24,7 @@ func FindFederatedRepoByRepoID(ctx context.Context, repoId int64) ([]*FederatedR
return federatedRepoList, sess.Find(&federatedRepoList)
}
// ToDo: Name this ...repos
func UpdateFederatedRepo(ctx context.Context, localRepoId int64, federatedRepoList []*FederatedRepo) error {
func StoreFederatedRepos(ctx context.Context, localRepoId int64, federatedRepoList []*FederatedRepo) error {
for _, federatedRepo := range federatedRepoList {
if res, err := validation.IsValid(*federatedRepo); !res {
return fmt.Errorf("FederationInfo is not valid: %v", err)

View file

@ -212,7 +212,7 @@ func CreateUserFromAP(ctx context.Context, personID forgefed.PersonID, federatio
}
// Create or update a list of FederatedRepo structs
func UpdateFederatedRepoList(ctx context.Context, localRepoId int64, federatedRepoList []string) (int, string, error) {
func StoreFederatedRepoList(ctx context.Context, localRepoId int64, federatedRepoList []string) (int, string, error) {
federatedRepos := make([]*repo.FederatedRepo, 0, len(federatedRepoList))
for _, uri := range federatedRepoList {
federationHost, err := GetFederationHostForUri(ctx, uri)
@ -230,7 +230,7 @@ func UpdateFederatedRepoList(ctx context.Context, localRepoId int64, federatedRe
federatedRepos = append(federatedRepos, &federatedRepo)
}
repo.UpdateFederatedRepo(ctx, localRepoId, federatedRepos)
repo.StoreFederatedRepos(ctx, localRepoId, federatedRepos)
return 0, "", nil
}

View file

@ -204,7 +204,7 @@ func SettingsPost(ctx *context.Context) {
return
}
if _, _, err := forgefed.UpdateFederatedRepoList(ctx, ctx.Repo.Repository.ID, strings.Split(federationRepos, ";")); err != nil {
if _, _, err := forgefed.StoreFederatedRepoList(ctx, ctx.Repo.Repository.ID, strings.Split(federationRepos, ";")); err != nil {
ctx.ServerError("UpdateRepository", err)
return
}