From e4242dafd931bc64cbb1359010f8641358972e11 Mon Sep 17 00:00:00 2001 From: erik Date: Thu, 21 Mar 2024 14:41:11 +0100 Subject: [PATCH] Add Function description --- modules/forgefed/federation_service.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/forgefed/federation_service.go b/modules/forgefed/federation_service.go index dd3b94777a..68c8212882 100644 --- a/modules/forgefed/federation_service.go +++ b/modules/forgefed/federation_service.go @@ -22,6 +22,13 @@ import ( "github.com/google/uuid" ) +// LikeActivity receives a ForgeLike activity and does the following: +// Validation of the activity +// Creation of a (remote) federationHost if not existing +// Creation of a forgefed Person if not existing +// Validation of incoming RepositoryID against Local RepositoryID +// Star the repo if it wasn't already stared +// Do some mitigation against out of order attacks func LikeActivity(ctx *context.APIContext, form any, repositoryID int64) (int, string, error) { activity := form.(*forgefed.ForgeLike) if res, err := validation.IsValid(activity); !res {