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

Rename to ParseActorIDFromStarActivity

This commit is contained in:
erik 2023-11-29 13:26:35 +01:00 committed by Michael Jerger
parent 2c4089ba1d
commit fde8de4f90
3 changed files with 5 additions and 5 deletions

View file

@ -98,7 +98,7 @@ func (a ActorID) GetHostAndPort() string {
return a.host
}
func ParseActorFromStarActivity(star *forgefed.Star) (ActorID, error) {
func ParseActorIDFromStarActivity(star *forgefed.Star) (ActorID, error) {
u, err := url.Parse(star.Actor.GetID().String())
// check if userID IRI is well formed url

View file

@ -32,7 +32,7 @@ func TestActorParserEmpty(t *testing.T) {
item := emptyMockStar
want := ActorID{}
got, _ := ParseActorFromStarActivity(item)
got, _ := ParseActorIDFromStarActivity(item)
if got != want {
t.Errorf("ParseActorID returned non empty actor id for empty input.")
@ -50,7 +50,7 @@ func TestActorParserValid(t *testing.T) {
port: "",
}
got, _ := ParseActorFromStarActivity(item)
got, _ := ParseActorIDFromStarActivity(item)
if got != want {
t.Errorf("\nParseActorID did not return want: %v\n but %v", want, got)
@ -75,7 +75,7 @@ func TestValidateValid(t *testing.T) {
func TestValidateInvalid(t *testing.T) {
item := emptyMockStar
actor, _ := ParseActorFromStarActivity(item)
actor, _ := ParseActorIDFromStarActivity(item)
if valid, _ := actor.IsValid(); valid {
t.Errorf("Actor was valid with invalid input.")

View file

@ -79,7 +79,7 @@ func RepositoryInbox(ctx *context.APIContext) {
// assume actor is: "actor": "https://codeberg.org/api/v1/activitypub/user-id/12345" - NB: This might be actually the ID? Maybe check vocabulary.
// parse actor
actor, err := activitypub.ParseActorFromStarActivity(opt)
actor, err := activitypub.ParseActorIDFromStarActivity(opt)
// Is the actor IRI well formed?
if err != nil {