summaryrefslogtreecommitdiff
path: root/internal/processing/status/get.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2023-11-17 11:35:28 +0100
committerLibravatar GitHub <noreply@github.com>2023-11-17 11:35:28 +0100
commitfc02d3c6f7db5a7794448f31fd9d6d81d3d224eb (patch)
treef792f799abadf784e493933af597d8f2292ab776 /internal/processing/status/get.go
parent[bugfix] process account delete side effects in serial, not in parallel (#2360) (diff)
downloadgotosocial-fc02d3c6f7db5a7794448f31fd9d6d81d3d224eb.tar.xz
[feature] Set/show instance language(s); show post language on frontend (#2362)
* update go text, include text/display * [feature] Set instance langs, show post lang on frontend * go fmt * WebGet * set language for whole article, don't use FA icon * mention instance languages + other optional config vars * little tweak * put languages in config properly * warn log language parse * change some naming around * tidy up validate a bit * lint * rename LanguageTmpl in template
Diffstat (limited to 'internal/processing/status/get.go')
-rw-r--r--internal/processing/status/get.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/internal/processing/status/get.go b/internal/processing/status/get.go
index 170dd0e53..ae6918e3f 100644
--- a/internal/processing/status/get.go
+++ b/internal/processing/status/get.go
@@ -36,6 +36,21 @@ func (p *Processor) Get(ctx context.Context, requestingAccount *gtsmodel.Account
return p.c.GetAPIStatus(ctx, requestingAccount, targetStatus)
}
+// WebGet gets the given status for web use, taking account of privacy settings.
+func (p *Processor) WebGet(ctx context.Context, targetStatusID string) (*apimodel.Status, gtserror.WithCode) {
+ targetStatus, errWithCode := p.c.GetVisibleTargetStatus(ctx, nil, targetStatusID)
+ if errWithCode != nil {
+ return nil, errWithCode
+ }
+
+ webStatus, err := p.converter.StatusToWebStatus(ctx, targetStatus, nil)
+ if err != nil {
+ err = gtserror.Newf("error converting status: %w", err)
+ return nil, gtserror.NewErrorInternalError(err)
+ }
+ return webStatus, nil
+}
+
func (p *Processor) contextGet(
ctx context.Context,
requestingAccount *gtsmodel.Account,