From fc02d3c6f7db5a7794448f31fd9d6d81d3d224eb Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Fri, 17 Nov 2023 11:35:28 +0100 Subject: [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 --- internal/processing/status/get.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'internal/processing/status/get.go') 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, -- cgit v1.2.3