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

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)
httpStatus, title, err := federation.ProcessLikeActivity(ctx, form, repository.ID)
if err != nil {
log.Error("Status: %v", httpStatus)
log.Error("Title: %v", title)
log.Error("Error: %v", err)
ctx.Error(httpStatus, title, err)
}
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)
for _, followingRepo := range followingRepos {
log.Info("Found following repo: %v", followingRepo)
target := followingRepo.URI
likeActivity, err := forgefed.NewForgeLike(doer.APAPIURL(), target, time.Now())
if err != nil {

View file

@ -12,6 +12,7 @@ import (
"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 {
if err := repo.StarRepo(ctx, doer.ID, repoID, star); err != nil {
return err