mirror of
https://github.com/writefreely/writefreely
synced 2024-11-24 09:33:11 +00:00
Fix error / info logging around AP mentions
This fixes log formatting and makes verbiage consistent & concise.
This commit is contained in:
parent
471a9e0602
commit
97aec9c158
3 changed files with 7 additions and 7 deletions
|
@ -2618,21 +2618,21 @@ func (db *datastore) GetProfilePageFromHandle(app *App, handle string) (string,
|
|||
if errRemoteUser == nil {
|
||||
_, err := app.db.Exec("UPDATE remoteusers SET handle = ? WHERE actor_id = ?", handle, actorIRI)
|
||||
if err != nil {
|
||||
log.Error("Can't update handle (" + handle + ") in database for user " + actorIRI)
|
||||
log.Error("Couldn't update handle '%s' for user %s", handle, actorIRI)
|
||||
}
|
||||
} else {
|
||||
// this probably means we don't have the user in the table so let's try to insert it
|
||||
// here we need to ask the server for the inboxes
|
||||
remoteActor, err := activityserve.NewRemoteActor(actorIRI)
|
||||
if err != nil {
|
||||
log.Error("Couldn't fetch remote actor", err)
|
||||
log.Error("Couldn't fetch remote actor: %v", err)
|
||||
}
|
||||
if debugging {
|
||||
log.Info("%s %s %s %s", actorIRI, remoteActor.GetInbox(), remoteActor.GetSharedInbox(), handle)
|
||||
}
|
||||
_, err = app.db.Exec("INSERT INTO remoteusers (actor_id, inbox, shared_inbox, handle) VALUES(?, ?, ?, ?)", actorIRI, remoteActor.GetInbox(), remoteActor.GetSharedInbox(), handle)
|
||||
if err != nil {
|
||||
log.Error("Can't insert remote user in database", err)
|
||||
log.Error("Couldn't insert remote user: %v", err)
|
||||
return "", err
|
||||
}
|
||||
}
|
||||
|
|
2
posts.go
2
posts.go
|
@ -1181,7 +1181,7 @@ func (p *PublicPost) ActivityObject(app *App) *activitystreams.Object {
|
|||
for _, handle := range mentions {
|
||||
actorIRI, err := app.db.GetProfilePageFromHandle(app, handle)
|
||||
if err != nil {
|
||||
log.Info("Can't find this user either in the database nor in the remote instance")
|
||||
log.Info("Couldn't find this user locally or remotely")
|
||||
continue
|
||||
}
|
||||
mentionedUsers[handle] = actorIRI
|
||||
|
|
|
@ -101,20 +101,20 @@ func RemoteLookup(handle string) string {
|
|||
parts := strings.Split(handle, "@")
|
||||
resp, err := http.Get("https://" + parts[1] + "/.well-known/webfinger?resource=acct:" + handle)
|
||||
if err != nil {
|
||||
log.Error("Error performing webfinger request", err)
|
||||
log.Error("Error on webfinger request: %v", err)
|
||||
return ""
|
||||
}
|
||||
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
log.Error("Error reading webfinger response", err)
|
||||
log.Error("Error on webfinger response: %v", err)
|
||||
return ""
|
||||
}
|
||||
|
||||
var result webfinger.Resource
|
||||
err = json.Unmarshal(body, &result)
|
||||
if err != nil {
|
||||
log.Error("Unsupported webfinger response received: %v", err)
|
||||
log.Error("Unable to parse webfinger response: %v", err)
|
||||
return ""
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue