From 0e2c34219112db3a6b7801530a946fd5b1bbb111 Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Fri, 1 Dec 2023 15:27:15 +0100 Subject: [bugfix/chore] `Announce` reliability updates (#2405) * [bugfix/chore] `Announce` updates * test update * fix tests * TestParseAnnounce * update comments * don't lock/unlock, change function signature * naming stuff * don't check domain block twice * UnwrapIfBoost * beep boop --- internal/processing/common/status.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'internal/processing/common') diff --git a/internal/processing/common/status.go b/internal/processing/common/status.go index 233c1c867..0a1f495fb 100644 --- a/internal/processing/common/status.go +++ b/internal/processing/common/status.go @@ -119,6 +119,25 @@ func (p *Processor) GetVisibleTargetStatus( return target, nil } +// UnwrapIfBoost "unwraps" the given status if +// it's a boost wrapper, by returning the boosted +// status it targets (pending visibility checks). +// +// Just returns the input status if it's not a boost. +func (p *Processor) UnwrapIfBoost( + ctx context.Context, + requester *gtsmodel.Account, + status *gtsmodel.Status, +) (*gtsmodel.Status, gtserror.WithCode) { + if status.BoostOfID == "" { + return status, nil + } + + return p.GetVisibleTargetStatus(ctx, + requester, status.BoostOfID, + ) +} + // GetAPIStatus fetches the appropriate API status model for target. func (p *Processor) GetAPIStatus( ctx context.Context, -- cgit v1.2.3