Feat add actors to meilisearch (#1048)
* initial commit * update api docs * adds search token versioning * make id filterable * isLocal -> is_local * add iri to actor index * update gitignore * Merge remote-tracking branch 'origin/main' into feat-add-actors-to-meilisearch * fix sharing for newly discovered actors * fix ActorSearchResult type --------- Co-authored-by: Christian Beutel <>
This commit is contained in:
@@ -69,7 +69,7 @@ func GetActorByHandle(app core.App, ctx context.Context, handle string, includeF
|
||||
if domain != "" {
|
||||
filter += "domain={:domain}"
|
||||
} else {
|
||||
filter += "isLocal=true"
|
||||
filter += "is_local=true"
|
||||
}
|
||||
|
||||
var dbActor *core.Record
|
||||
@@ -81,7 +81,7 @@ func GetActorByHandle(app core.App, ctx context.Context, handle string, includeF
|
||||
}
|
||||
|
||||
dbActor = core.NewRecord(collection)
|
||||
dbActor.Set("isLocal", false)
|
||||
dbActor.Set("is_local", false)
|
||||
iri, err := iriFromHandle(ctx, domain, username)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -105,7 +105,7 @@ func GetActorByIRI(app core.App, ctx context.Context, iri string, includeFollows
|
||||
}
|
||||
|
||||
dbActor = core.NewRecord(collection)
|
||||
dbActor.Set("isLocal", false)
|
||||
dbActor.Set("is_local", false)
|
||||
dbActor.Set("iri", iri)
|
||||
|
||||
} else if err != nil {
|
||||
@@ -167,7 +167,7 @@ func assembleActor(app core.App, ctx context.Context, dbActor *core.Record, incl
|
||||
}
|
||||
|
||||
private := false
|
||||
if dbActor.GetBool("isLocal") {
|
||||
if dbActor.GetBool("is_local") {
|
||||
user, err := app.FindRecordById("users", dbActor.GetString("user"))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -132,7 +132,7 @@ func processTrailAnnounceActivity(app core.App, actor *core.Record, activity pub
|
||||
}
|
||||
|
||||
var trail *core.Record
|
||||
if !actor.GetBool("isLocal") {
|
||||
if !actor.GetBool("is_local") {
|
||||
trail, err = util.TrailFromActivity(activity, app, actor)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -210,7 +210,7 @@ func processListAnnounceActivity(app core.App, actor *core.Record, activity pub.
|
||||
}
|
||||
|
||||
var list *core.Record
|
||||
if !actor.GetBool("isLocal") {
|
||||
if !actor.GetBool("is_local") {
|
||||
list, err = util.ListFromActivity(activity, app, actor)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -531,7 +531,7 @@ func processCreateOrUpdateCommentActivity(activity pub.Activity, app core.App, a
|
||||
}
|
||||
|
||||
// no need to do anything else if the actor is local
|
||||
if actor.GetBool("isLocal") {
|
||||
if actor.GetBool("is_local") {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -645,7 +645,7 @@ func processCreateOrUpdateSummitLogActivity(activity pub.Activity, app core.App,
|
||||
}
|
||||
}
|
||||
// no need to do anything else if the actor is local
|
||||
if actor.GetBool("isLocal") {
|
||||
if actor.GetBool("is_local") {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ func CreateCommentDeleteActivity(app core.App, client meilisearch.ServiceManager
|
||||
return err
|
||||
}
|
||||
|
||||
if !author.GetBool("isLocal") {
|
||||
if !author.GetBool("is_local") {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ func CreateCommentDeleteActivity(app core.App, client meilisearch.ServiceManager
|
||||
return err
|
||||
}
|
||||
|
||||
if commentTrailAuthor.GetBool("isLocal") {
|
||||
if commentTrailAuthor.GetBool("is_local") {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ func CreateSummitLogDeleteActivity(app core.App, r *core.Record) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if !author.GetBool("isLocal") {
|
||||
if !author.GetBool("is_local") {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ func CreateListDeleteActivity(app core.App, r *core.Record) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if !author.GetBool("isLocal") {
|
||||
if !author.GetBool("is_local") {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -290,7 +290,7 @@ func CreateListDeleteActivity(app core.App, r *core.Record) error {
|
||||
|
||||
func ProcessDeleteActivity(app core.App, actor *core.Record, activity pub.Activity) error {
|
||||
// no need to do anything if the actor is local
|
||||
if actor.GetBool("isLocal") {
|
||||
if actor.GetBool("is_local") {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ func ProcessFollowActivity(app core.App, actor *core.Record, activity pub.Activi
|
||||
// a remote actor has requested the follow
|
||||
// this means we have not yet created a follow entry in our db
|
||||
// we accept it immediately
|
||||
if !actor.GetBool("isLocal") {
|
||||
if !actor.GetBool("is_local") {
|
||||
followCollection, err := app.FindCollectionByNameOrId("follows")
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -80,7 +80,7 @@ func ProcessLikeActivity(app core.App, actor *core.Record, activity pub.Activity
|
||||
return err
|
||||
}
|
||||
|
||||
if !actor.GetBool("isLocal") {
|
||||
if !actor.GetBool("is_local") {
|
||||
trailLikeCollection, err := app.FindCollectionByNameOrId("trail_like")
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -140,7 +140,7 @@ func ProcessUndoActivity(app core.App, actor *core.Record, activity pub.Activity
|
||||
|
||||
func processUnfollowActivity(app core.App, actor *core.Record, activity pub.Activity) error {
|
||||
// this was a local follow
|
||||
if actor.GetBool("isLocal") {
|
||||
if actor.GetBool("is_local") {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ func processUnfollowActivity(app core.App, actor *core.Record, activity pub.Acti
|
||||
}
|
||||
|
||||
func processUnlikeActivity(app core.App, actor *core.Record, activity pub.Activity) error {
|
||||
if actor.GetBool("isLocal") {
|
||||
if actor.GetBool("is_local") {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user