mirror of
https://codeberg.org/forgejo/forgejo
synced 2024-11-22 09:54:24 +01:00
Rename to StoreFederatedRepo*
This commit is contained in:
parent
ca7d1c6f78
commit
35d3fc199c
|
@ -24,8 +24,7 @@ func FindFederatedRepoByRepoID(ctx context.Context, repoId int64) ([]*FederatedR
|
||||||
return federatedRepoList, sess.Find(&federatedRepoList)
|
return federatedRepoList, sess.Find(&federatedRepoList)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToDo: Name this ...repos
|
func StoreFederatedRepos(ctx context.Context, localRepoId int64, federatedRepoList []*FederatedRepo) error {
|
||||||
func UpdateFederatedRepo(ctx context.Context, localRepoId int64, federatedRepoList []*FederatedRepo) error {
|
|
||||||
for _, federatedRepo := range federatedRepoList {
|
for _, federatedRepo := range federatedRepoList {
|
||||||
if res, err := validation.IsValid(*federatedRepo); !res {
|
if res, err := validation.IsValid(*federatedRepo); !res {
|
||||||
return fmt.Errorf("FederationInfo is not valid: %v", err)
|
return fmt.Errorf("FederationInfo is not valid: %v", err)
|
||||||
|
|
|
@ -212,7 +212,7 @@ func CreateUserFromAP(ctx context.Context, personID forgefed.PersonID, federatio
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create or update a list of FederatedRepo structs
|
// 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))
|
federatedRepos := make([]*repo.FederatedRepo, 0, len(federatedRepoList))
|
||||||
for _, uri := range federatedRepoList {
|
for _, uri := range federatedRepoList {
|
||||||
federationHost, err := GetFederationHostForUri(ctx, uri)
|
federationHost, err := GetFederationHostForUri(ctx, uri)
|
||||||
|
@ -230,7 +230,7 @@ func UpdateFederatedRepoList(ctx context.Context, localRepoId int64, federatedRe
|
||||||
federatedRepos = append(federatedRepos, &federatedRepo)
|
federatedRepos = append(federatedRepos, &federatedRepo)
|
||||||
}
|
}
|
||||||
|
|
||||||
repo.UpdateFederatedRepo(ctx, localRepoId, federatedRepos)
|
repo.StoreFederatedRepos(ctx, localRepoId, federatedRepos)
|
||||||
|
|
||||||
return 0, "", nil
|
return 0, "", nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -204,7 +204,7 @@ func SettingsPost(ctx *context.Context) {
|
||||||
return
|
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)
|
ctx.ServerError("UpdateRepository", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue