diff options
author | 2024-01-26 14:17:10 +0100 | |
---|---|---|
committer | 2024-01-26 14:17:10 +0100 | |
commit | e3052e8c825da699162ea25367e860ac3c66f461 (patch) | |
tree | 3d13e83413d4a85ab694034d6c9772f9ec64268a /internal/typeutils/astointernal.go | |
parent | [performance] cache library performance enhancements (updates go-structr => v... (diff) | |
download | gotosocial-e3052e8c825da699162ea25367e860ac3c66f461.tar.xz |
[bugfix] Don't return Account or Status if new and dereferencing failed, other small fixes (#2563)
* tidy up account, status, webfingering logic a wee bit
* go fmt
* invert published check
* alter resp initialization
* get Published from account in typeutils
* don't instantiate error for no darn good reason
* shadow err
* don't repeat error codes in wrapped errors
* don't wrap error unnecessarily
Diffstat (limited to 'internal/typeutils/astointernal.go')
-rw-r--r-- | internal/typeutils/astointernal.go | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/internal/typeutils/astointernal.go b/internal/typeutils/astointernal.go index 8a451adc8..fa2ae6a62 100644 --- a/internal/typeutils/astointernal.go +++ b/internal/typeutils/astointernal.go @@ -77,6 +77,18 @@ func (c *Converter) ASRepresentationToAccount(ctx context.Context, accountable a return nil, gtserror.SetMalformed(err) } + // Extract published time if possible. + // + // This denotes original creation time + // of the account on the remote instance. + // + // Not every implementation uses this property; + // so don't bother warning if we can't find it. + if pub := ap.GetPublished(accountable); !pub.IsZero() { + acct.CreatedAt = pub + acct.UpdatedAt = pub + } + // Extract a preferred name (display name), fallback to username. if displayName := ap.ExtractName(accountable); displayName != "" { acct.DisplayName = displayName @@ -300,7 +312,7 @@ func (c *Converter) ASStatusToStatus(ctx context.Context, statusable ap.Statusab // status.Published // - // Extract published time for the boost, + // Extract published time for the status, // zero-time will fall back to db defaults. if pub := ap.GetPublished(statusable); !pub.IsZero() { status.CreatedAt = pub |