@@ -25,7 +25,6 @@ import (
2525 "github.com/guregu/null/zero"
2626 "github.com/kylemcc/twitter-text-go/extract"
2727 "github.com/microcosm-cc/bluemonday"
28- "github.com/writeas/activityserve"
2928 stripmd "github.com/writeas/go-strip-markdown"
3029 "github.com/writeas/impart"
3130 "github.com/writeas/monday"
@@ -1118,37 +1117,10 @@ func (p *PublicPost) ActivityObject(app *App) *activitystreams.Object {
11181117 mentions := mentionRegex .FindAllString (content , - 1 )
11191118
11201119 for _ , handle := range mentions {
1121- var actorIRI string
1122- remoteuser , errRemoteUser := getRemoteUserFromHandle (app , handle )
1123- if errRemoteUser != nil {
1124- // can't find using handle in the table but the table may already have this user without
1125- // handle from a previous version
1126- actorIRI = RemoteLookup (handle )
1127- _ , errRemoteUser := getRemoteUser (app , actorIRI )
1128- // if it exists then we need to update the handle
1129- if errRemoteUser == nil {
1130- // query := "UPDATE remoteusers SET handle='" + handle + "' WHERE actor_id='" + iri + "';"
1131- // log.Info(query)
1132- _ , err := app .db .Exec ("UPDATE remoteusers SET handle=? WHERE actor_id=?;" , handle , actorIRI )
1133- if err != nil {
1134- log .Error ("Can't update handle (" + handle + ") in database for user " + actorIRI )
1135- }
1136- } else {
1137- // this probably means we don't have the user in the table so let's try to insert it
1138- // here we need to ask the server for the inboxes
1139- remoteActor , err := activityserve .NewRemoteActor (actorIRI )
1140- if err != nil {
1141- log .Error ("Couldn't fetch remote actor" , err )
1142- }
1143- fmt .Println (actorIRI , remoteActor .GetInbox (), remoteActor .GetSharedInbox (), handle )
1144- _ , err = app .db .Exec ("INSERT INTO remoteusers (actor_id, inbox, shared_inbox, handle) VALUES( ?, ?, ?, ?)" , actorIRI , remoteActor .GetInbox (), remoteActor .GetSharedInbox (), handle )
1145- if err != nil {
1146- log .Error ("Can't insert remote user in database" , err )
1147- return nil
1148- }
1149- }
1150- } else {
1151- actorIRI = remoteuser .ActorID
1120+ actorIRI , err := app .db .getProfilePageFromHandle (app , handle )
1121+ if err != nil {
1122+ log .Info ("Can't find this user either in the database nor in the remote instance" )
1123+ return nil
11521124 }
11531125 mentionedUsers [handle ] = actorIRI
11541126 }
0 commit comments