Hack: Allow for me specifically to migrate to GoToSocial

This commit is contained in:
Rafael Caricio 2023-08-07 19:06:21 +02:00
parent 120510ccbf
commit 02d2270d81
Signed by: rafaelcaricio
GPG key ID: 3C86DBCE8E93C947

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)