From e3052e8c825da699162ea25367e860ac3c66f461 Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Fri, 26 Jan 2024 14:17:10 +0100 Subject: [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 --- internal/gtsmodel/account.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'internal/gtsmodel/account.go') diff --git a/internal/gtsmodel/account.go b/internal/gtsmodel/account.go index fb6c54bec..f5b487cc8 100644 --- a/internal/gtsmodel/account.go +++ b/internal/gtsmodel/account.go @@ -96,6 +96,12 @@ func (a *Account) IsRemote() bool { return !a.IsLocal() } +// IsNew returns whether an account is "new" in the sense +// that it has not been previously stored in the database. +func (a *Account) IsNew() bool { + return a.CreatedAt.IsZero() +} + // IsInstance returns whether account is an instance internal actor account. func (a *Account) IsInstance() bool { if a.IsLocal() { -- cgit v1.2.3