Sent user activities to distant federated server (#8792)

This PR is part of #4767. It contains

* a refactoring of validation error messages
* adds the ability to send user-activities to distant federated servers

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8792
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Michael Jerger <michael.jerger@meissa-gmbh.de>
Co-committed-by: Michael Jerger <michael.jerger@meissa-gmbh.de>
This commit is contained in:
Michael Jerger 2025-08-06 16:16:13 +02:00 committed by Earl Warren
commit c081f20776
22 changed files with 885 additions and 130 deletions

View file

@ -9,6 +9,7 @@ import (
"forgejo.org/modules/validation"
ap "github.com/go-ap/activitypub"
"github.com/stretchr/testify/assert"
)
func Test_NewForgeFollowValidation(t *testing.T) {
@ -17,15 +18,13 @@ func Test_NewForgeFollowValidation(t *testing.T) {
sut.Actor = ap.IRI("example.org/alice")
sut.Object = ap.IRI("example.org/bob")
if err, _ := validation.IsValid(sut); !err {
t.Errorf("sut is invalid: %v\n", err)
}
valid, err := validation.IsValid(sut)
assert.True(t, valid, "sut is invalid: %v\n", err)
sut = ForgeFollow{}
sut.Actor = ap.IRI("example.org/alice")
sut.Object = ap.IRI("example.org/bob")
if err, _ := validation.IsValid(sut); err {
t.Errorf("sut is valid: %v\n", err)
}
valid, err = validation.IsValid(sut)
assert.False(t, valid, "sut is valid: %v\n", err)
}