mirror of
1
Fork 0

Merge branch 'forgejo-federated-star' of codeberg.org:meissa/forgejo into forgejo-federated-star

This commit is contained in:
Michael Jerger 2024-04-06 10:59:41 +02:00
commit 213fc3a97d
3 changed files with 5 additions and 0 deletions

View File

@ -74,6 +74,9 @@ func RepositoryInbox(ctx *context.APIContext) {
form := web.GetForm(ctx) form := web.GetForm(ctx)
httpStatus, title, err := federation.ProcessLikeActivity(ctx, form, repository.ID) httpStatus, title, err := federation.ProcessLikeActivity(ctx, form, repository.ID)
if err != nil { if err != nil {
log.Error("Status: %v", httpStatus)
log.Error("Title: %v", title)
log.Error("Error: %v", err)
ctx.Error(httpStatus, title, err) ctx.Error(httpStatus, title, err)
} }
ctx.Status(http.StatusNoContent) ctx.Status(http.StatusNoContent)

View File

@ -252,6 +252,7 @@ func SendLikeActivities(ctx context.Context, doer user.User, repoID int64) error
likeActivityList := make([]forgefed.ForgeLike, 0) likeActivityList := make([]forgefed.ForgeLike, 0)
for _, followingRepo := range followingRepos { for _, followingRepo := range followingRepos {
log.Info("Found following repo: %v", followingRepo)
target := followingRepo.URI target := followingRepo.URI
likeActivity, err := forgefed.NewForgeLike(doer.APAPIURL(), target, time.Now()) likeActivity, err := forgefed.NewForgeLike(doer.APAPIURL(), target, time.Now())
if err != nil { if err != nil {

View File

@ -12,6 +12,7 @@ import (
"code.gitea.io/gitea/services/federation" "code.gitea.io/gitea/services/federation"
) )
// ToDo: Consistent Naming, smth like StarLocalAndFollowingRepo
func StarRepoAndFederate(ctx context.Context, doer user.User, repoID int64, star bool) error { func StarRepoAndFederate(ctx context.Context, doer user.User, repoID int64, star bool) error {
if err := repo.StarRepo(ctx, doer.ID, repoID, star); err != nil { if err := repo.StarRepo(ctx, doer.ID, repoID, star); err != nil {
return err return err