summaryrefslogtreecommitdiff
path: root/internal/processing/common
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2023-12-01 15:27:15 +0100
committerLibravatar GitHub <noreply@github.com>2023-12-01 15:27:15 +0100
commit0e2c34219112db3a6b7801530a946fd5b1bbb111 (patch)
tree6a5557373dbfc9edc80de941b13e870a8af32881 /internal/processing/common
parent[bugfix] in fedi API CreateStatus(), handle case of data-race and return earl... (diff)
downloadgotosocial-0e2c34219112db3a6b7801530a946fd5b1bbb111.tar.xz
[bugfix/chore] `Announce` reliability updates (#2405)v0.13.0-rc1
* [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
Diffstat (limited to 'internal/processing/common')
-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,