mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-10 04:05:42 +01:00
Rename to ParseActorIDFromStarActivity
This commit is contained in:
parent
2c4089ba1d
commit
fde8de4f90
3 changed files with 5 additions and 5 deletions
|
@ -98,7 +98,7 @@ func (a ActorID) GetHostAndPort() string {
|
||||||
return a.host
|
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())
|
u, err := url.Parse(star.Actor.GetID().String())
|
||||||
|
|
||||||
// check if userID IRI is well formed url
|
// check if userID IRI is well formed url
|
||||||
|
|
|
@ -32,7 +32,7 @@ func TestActorParserEmpty(t *testing.T) {
|
||||||
item := emptyMockStar
|
item := emptyMockStar
|
||||||
want := ActorID{}
|
want := ActorID{}
|
||||||
|
|
||||||
got, _ := ParseActorFromStarActivity(item)
|
got, _ := ParseActorIDFromStarActivity(item)
|
||||||
|
|
||||||
if got != want {
|
if got != want {
|
||||||
t.Errorf("ParseActorID returned non empty actor id for empty input.")
|
t.Errorf("ParseActorID returned non empty actor id for empty input.")
|
||||||
|
@ -50,7 +50,7 @@ func TestActorParserValid(t *testing.T) {
|
||||||
port: "",
|
port: "",
|
||||||
}
|
}
|
||||||
|
|
||||||
got, _ := ParseActorFromStarActivity(item)
|
got, _ := ParseActorIDFromStarActivity(item)
|
||||||
|
|
||||||
if got != want {
|
if got != want {
|
||||||
t.Errorf("\nParseActorID did not return want: %v\n but %v", want, got)
|
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) {
|
func TestValidateInvalid(t *testing.T) {
|
||||||
item := emptyMockStar
|
item := emptyMockStar
|
||||||
|
|
||||||
actor, _ := ParseActorFromStarActivity(item)
|
actor, _ := ParseActorIDFromStarActivity(item)
|
||||||
|
|
||||||
if valid, _ := actor.IsValid(); valid {
|
if valid, _ := actor.IsValid(); valid {
|
||||||
t.Errorf("Actor was valid with invalid input.")
|
t.Errorf("Actor was valid with invalid input.")
|
||||||
|
|
|
@ -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.
|
// 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
|
// parse actor
|
||||||
actor, err := activitypub.ParseActorFromStarActivity(opt)
|
actor, err := activitypub.ParseActorIDFromStarActivity(opt)
|
||||||
|
|
||||||
// Is the actor IRI well formed?
|
// Is the actor IRI well formed?
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue