diff options
author | 2023-03-31 15:01:29 +0200 | |
---|---|---|
committer | 2023-03-31 15:01:29 +0200 | |
commit | d9bbcc60a6cd32282de907a2090c674c4616219e (patch) | |
tree | c007cf145ebe24fcc3de420020722a4ea70fb803 /internal/typeutils/internaltofrontend.go | |
parent | [bugfix] Fix relationship not updating 'following' on accept follow request (... (diff) | |
download | gotosocial-d9bbcc60a6cd32282de907a2090c674c4616219e.tar.xz |
[bugfix] Fix report serialization errors caused by user delete (#1659)
* [bugfix] Fix report serialization errors caused by user delete
* fix tests
Diffstat (limited to 'internal/typeutils/internaltofrontend.go')
-rw-r--r-- | internal/typeutils/internaltofrontend.go | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/internal/typeutils/internaltofrontend.go b/internal/typeutils/internaltofrontend.go index 198bed099..74b061fb0 100644 --- a/internal/typeutils/internaltofrontend.go +++ b/internal/typeutils/internaltofrontend.go @@ -270,7 +270,7 @@ func (c *converter) AccountToAdminAPIAccount(ctx context.Context, a *gtsmodel.Ac ) // take user-level information if possible - if a.Domain != "" { + if a.IsRemote() { domain = &a.Domain } else { user, err := c.db.GetUserByAccountID(ctx, a.ID) @@ -289,7 +289,9 @@ func (c *converter) AccountToAdminAPIAccount(ctx context.Context, a *gtsmodel.Ac } locale = user.Locale - inviteRequest = &user.Account.Reason + if user.Account.Reason != "" { + inviteRequest = &user.Account.Reason + } if *user.Admin { role.Name = apimodel.AccountRoleAdmin } else if *user.Moderator { @@ -298,11 +300,12 @@ func (c *converter) AccountToAdminAPIAccount(ctx context.Context, a *gtsmodel.Ac confirmed = !user.ConfirmedAt.IsZero() approved = *user.Approved disabled = *user.Disabled - silenced = !user.Account.SilencedAt.IsZero() - suspended = !user.Account.SuspendedAt.IsZero() createdByApplicationID = user.CreatedByApplicationID } + silenced = !a.SilencedAt.IsZero() + suspended = !a.SuspendedAt.IsZero() + apiAccount, err := c.AccountToAPIAccountPublic(ctx, a) if err != nil { return nil, fmt.Errorf("AccountToAdminAPIAccount: error converting account to api account for account id %s: %w", a.ID, err) |