summaryrefslogtreecommitdiff
path: root/internal/processing/common
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2024-01-16 17:22:44 +0100
committerLibravatar GitHub <noreply@github.com>2024-01-16 16:22:44 +0000
commitc36f9ac37b8bbdeb4def7a20ba8ea6d6b7ad12d5 (patch)
tree9569c022aaf5c4ceaaf5ce433c95d9d90b6402cc /internal/processing/common
parent[chore] Move to codeberg's exif-terminator (#2536) (diff)
downloadgotosocial-c36f9ac37b8bbdeb4def7a20ba8ea6d6b7ad12d5.tar.xz
[feature] Account alias / move API + db models (#2518)
* [feature] Account alias / move API + db models * go fmt * fix little cherry-pick issues * update error checking, formatting * add and use new util functions to simplify alias logic
Diffstat (limited to 'internal/processing/common')
-rw-r--r--internal/processing/common/account.go.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/internal/processing/common/account.go.go b/internal/processing/common/account.go.go
index 425f23483..c4436e77e 100644
--- a/internal/processing/common/account.go.go
+++ b/internal/processing/common/account.go.go
@@ -162,6 +162,23 @@ func (p *Processor) GetAPIAccountBlocked(
return apiAccount, nil
}
+// GetAPIAccountSensitive fetches the "sensitive" account model for the given target.
+// *BE CAREFUL!* Only return a sensitive account if targetAcc == account making the request.
+func (p *Processor) GetAPIAccountSensitive(
+ ctx context.Context,
+ targetAcc *gtsmodel.Account,
+) (
+ apiAcc *apimodel.Account,
+ errWithCode gtserror.WithCode,
+) {
+ apiAccount, err := p.converter.AccountToAPIAccountSensitive(ctx, targetAcc)
+ if err != nil {
+ err = gtserror.Newf("error converting account: %w", err)
+ return nil, gtserror.NewErrorInternalError(err)
+ }
+ return apiAccount, nil
+}
+
// GetVisibleAPIAccounts converts an array of gtsmodel.Accounts (inputted by next function) into
// public API model accounts, checking first for visibility. Please note that all errors will be
// logged at ERROR level, but will not be returned. Callers are likely to run into show-stopping