mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-24 08:57:03 -05:00
delete federated repos when deleting repository
This commit is contained in:
parent
8b56159042
commit
962cd374e2
2 changed files with 10 additions and 0 deletions
|
@ -237,6 +237,13 @@ func StoreFederatedRepoList(ctx context.Context, localRepoId int64, federatedRep
|
||||||
return 0, "", nil
|
return 0, "", nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func DeleteFederatedRepos(ctx context.Context, localRepoId int64) error {
|
||||||
|
if err := repo.StoreFederatedRepos(ctx, localRepoId, []*repo.FederatedRepo{}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func SendLikeActivities(ctx context.Context, doer user.User, repoID int64) error {
|
func SendLikeActivities(ctx context.Context, doer user.User, repoID int64) error {
|
||||||
federatedRepos, err := repo.FindFederatedReposByRepoID(ctx, repoID)
|
federatedRepos, err := repo.FindFederatedReposByRepoID(ctx, repoID)
|
||||||
log.Info("Federated Repos is: %v", federatedRepos)
|
log.Info("Federated Repos is: %v", federatedRepos)
|
||||||
|
|
|
@ -21,6 +21,7 @@ import (
|
||||||
repo_module "code.gitea.io/gitea/modules/repository"
|
repo_module "code.gitea.io/gitea/modules/repository"
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
"code.gitea.io/gitea/modules/structs"
|
"code.gitea.io/gitea/modules/structs"
|
||||||
|
federation_service "code.gitea.io/gitea/services/federation"
|
||||||
notify_service "code.gitea.io/gitea/services/notify"
|
notify_service "code.gitea.io/gitea/services/notify"
|
||||||
pull_service "code.gitea.io/gitea/services/pull"
|
pull_service "code.gitea.io/gitea/services/pull"
|
||||||
)
|
)
|
||||||
|
@ -66,6 +67,8 @@ func DeleteRepository(ctx context.Context, doer *user_model.User, repo *repo_mod
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
federation_service.DeleteFederatedRepos(ctx, repo.ID)
|
||||||
|
|
||||||
return packages_model.UnlinkRepositoryFromAllPackages(ctx, repo.ID)
|
return packages_model.UnlinkRepositoryFromAllPackages(ctx, repo.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue