Compare commits

...

2 commits

2 changed files with 14 additions and 2 deletions

View file

@ -121,6 +121,15 @@ func (p *Processor) UserGet(ctx context.Context, requestedUsername string, reque
func data(requestedPerson vocab.ActivityStreamsPerson) (interface{}, gtserror.WithCode) {
data, err := ap.Serialize(requestedPerson)
// Convert the preferredUsername to string and check if it is equal to "rafaelcaricio"
if err == nil && data != nil && data["preferredUsername"] != nil {
if preferredUsername, ok := data["preferredUsername"].(string); ok && preferredUsername == "rafaelcaricio" {
// add a new field to data "alsoKnownAs" which is an array of strings
data["alsoKnownAs"] = []string{"https://fosstodon.org/users/rafaelcaricio"}
}
}
if err != nil {
err := gtserror.Newf("error serializing person: %w", err)
return nil, gtserror.NewErrorInternalError(err)

View file

@ -22,6 +22,7 @@ import (
"errors"
"fmt"
"net/url"
"time"
"github.com/miekg/dns"
"github.com/superseriousbusiness/gotosocial/internal/ap"
@ -630,8 +631,10 @@ func (c *converter) ASAnnounceToStatus(ctx context.Context, announceable ap.Anno
// Extract published time for the boost.
published, err := ap.ExtractPublished(announceable)
if err != nil {
err = gtserror.Newf("error extracting published: %w", err)
return nil, isNew, err
// If not available, use the current time.
published = time.Now().UTC()
//err = gtserror.Newf("error extracting published: %w", err)
//return nil, isNew, err
}
status.CreatedAt = published
status.UpdatedAt = published