Use Actor type for Actor element of IntransitiveActivity
This commit is contained in:
parent
0cfdd8a760
commit
cb7f8c56f5
|
@ -70,7 +70,7 @@ type IntransitiveActivity struct {
|
|||
apObject
|
||||
// Describes one or more entities that either performed or are expected to perform the activity.
|
||||
// Any single activity can have multiple actors. The actor may be specified using an indirect Link.
|
||||
Actor ObjectOrLink `jsonld:"actor,omitempty"`
|
||||
Actor Actor `jsonld:"actor,omitempty"`
|
||||
// Describes the indirect object, or target, of the activity.
|
||||
// The precise meaning of the target is largely dependent on the type of action being described
|
||||
// but will often be the object of the English preposition "to".
|
||||
|
|
|
@ -18,19 +18,29 @@ func CreateActivityNew(id ObjectID, a ObjectOrLink, o ObjectOrLink) CreateActivi
|
|||
if a != nil {
|
||||
typ := a.Object().Type
|
||||
if typ == ApplicationType {
|
||||
act.Actor, ok = a.(Application)
|
||||
var app Application
|
||||
app, ok = a.(Application)
|
||||
act.Actor = Actor(app)
|
||||
}
|
||||
if typ == GroupType {
|
||||
act.Actor, ok = a.(Group)
|
||||
var grp Group
|
||||
grp, ok = a.(Group)
|
||||
act.Actor = Actor(grp)
|
||||
}
|
||||
if typ == OrganizationType {
|
||||
act.Actor, ok = a.(Organization)
|
||||
var org Organization
|
||||
org, ok = a.(Organization)
|
||||
act.Actor = Actor(org)
|
||||
}
|
||||
if typ == PersonType {
|
||||
act.Actor, ok = a.(Person)
|
||||
var pers Person
|
||||
pers, ok = a.(Person)
|
||||
act.Actor = Actor(pers)
|
||||
}
|
||||
if typ == ServiceType {
|
||||
act.Actor, ok = a.(Service)
|
||||
var serv Service
|
||||
serv, ok = a.(Service)
|
||||
act.Actor = Actor(serv)
|
||||
}
|
||||
if !ok {
|
||||
act.Actor, ok = a.(Actor)
|
||||
|
|
|
@ -45,8 +45,8 @@ func TestCreateActivityNewWithApplication(t *testing.T) {
|
|||
if !reflect.DeepEqual(c1.Activity.Actor.Object(), a.Object()) {
|
||||
t.Errorf("Actor %#v different than expected %#v", c1.Activity.Actor.Object(), a.Object())
|
||||
}
|
||||
if !reflect.DeepEqual(c1.Activity.Actor, *a) {
|
||||
t.Errorf("Actor %#v\n\n different than expected\n\n %#v", c1.Activity.Actor, *a)
|
||||
if !reflect.DeepEqual(c1.Activity.Actor, Actor(*a)) {
|
||||
t.Errorf("Actor %#v\n\n different than expected\n\n %#v", c1.Activity.Actor, Actor(*a))
|
||||
}
|
||||
if c1.Activity.Object.Object().ID != n.ID {
|
||||
t.Errorf("Object %q different than expected %q", c1.Activity.Object.Object().ID, n.ID)
|
||||
|
@ -81,8 +81,8 @@ func TestCreateActivityNewWithGroup(t *testing.T) {
|
|||
if !reflect.DeepEqual(c1.Activity.Actor.Object(), g.Object()) {
|
||||
t.Errorf("Actor %#v different than expected %#v", c1.Activity.Actor.Object(), g.Object())
|
||||
}
|
||||
if !reflect.DeepEqual(c1.Activity.Actor, *g) {
|
||||
t.Errorf("Actor %#v\n\n different than expected\n\n %#v", c1.Activity.Actor, *g)
|
||||
if !reflect.DeepEqual(c1.Activity.Actor, Actor(*g)) {
|
||||
t.Errorf("Actor %#v\n\n different than expected\n\n %#v", c1.Activity.Actor, Actor(*g))
|
||||
}
|
||||
if c1.Activity.Object.Object().ID != n.ID {
|
||||
t.Errorf("Object %q different than expected %q", c1.Activity.Object.Object().ID, n.ID)
|
||||
|
@ -117,8 +117,8 @@ func TestCreateActivityNewWithOrganization(t *testing.T) {
|
|||
if !reflect.DeepEqual(c1.Activity.Actor.Object(), o.Object()) {
|
||||
t.Errorf("Actor %#v different than expected %#v", c1.Activity.Actor.Object(), o.Object())
|
||||
}
|
||||
if !reflect.DeepEqual(c1.Activity.Actor, *o) {
|
||||
t.Errorf("Actor %#v\n\n different than expected\n\n %#v", c1.Activity.Actor, *o)
|
||||
if !reflect.DeepEqual(c1.Activity.Actor, Actor(*o)) {
|
||||
t.Errorf("Actor %#v\n\n different than expected\n\n %#v", c1.Activity.Actor, Actor(*o))
|
||||
}
|
||||
if c1.Activity.Object.Object().ID != n.ID {
|
||||
t.Errorf("Object %q different than expected %q", c1.Activity.Object.Object().ID, n.ID)
|
||||
|
@ -153,8 +153,8 @@ func TestCreateActivityNewWithPerson(t *testing.T) {
|
|||
if !reflect.DeepEqual(c1.Activity.Actor.Object(), b.Object()) {
|
||||
t.Errorf("Actor %#v different than expected %#v", c1.Activity.Actor.Object(), b.Object())
|
||||
}
|
||||
if !reflect.DeepEqual(c1.Activity.Actor, *b) {
|
||||
t.Errorf("Actor %#v\n\n different than expected\n\n %#v", c1.Activity.Actor, *b)
|
||||
if !reflect.DeepEqual(c1.Activity.Actor, Actor(*b)) {
|
||||
t.Errorf("Actor %#v\n\n different than expected\n\n %#v", c1.Activity.Actor, Actor(*b))
|
||||
}
|
||||
if c1.Activity.Object.Object().ID != n.ID {
|
||||
t.Errorf("Object %q different than expected %q", c1.Activity.Object.Object().ID, n.ID)
|
||||
|
@ -189,8 +189,8 @@ func TestCreateActivityNewWithService(t *testing.T) {
|
|||
if !reflect.DeepEqual(c1.Activity.Actor.Object(), s.Object()) {
|
||||
t.Errorf("Actor %#v different than expected %#v", c1.Activity.Actor.Object(), s.Object())
|
||||
}
|
||||
if !reflect.DeepEqual(c1.Activity.Actor, *s) {
|
||||
t.Errorf("Actor %#v\n\n different than expected\n\n %#v", c1.Activity.Actor, *s)
|
||||
if !reflect.DeepEqual(c1.Activity.Actor, Actor(*s)) {
|
||||
t.Errorf("Actor %#v\n\n different than expected\n\n %#v", c1.Activity.Actor, Actor(*s))
|
||||
}
|
||||
if c1.Activity.Object.Object().ID != n.ID {
|
||||
t.Errorf("Object %q different than expected %q", c1.Activity.Object.Object().ID, n.ID)
|
||||
|
|
Reference in a new issue