summaryrefslogtreecommitdiff
path: root/internal/processing/common/status.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/processing/common/status.go')
-rw-r--r--internal/processing/common/status.go19
1 files changed, 19 insertions, 0 deletions
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,