diff options
author | 2024-07-26 12:04:28 +0200 | |
---|---|---|
committer | 2024-07-26 12:04:28 +0200 | |
commit | 8ab2b19a946251f258446d22f420d401f61d22f6 (patch) | |
tree | 39fb674f135fd1cfcf4de5b319913f0d0c17d11a /internal/processing/status/fave.go | |
parent | [docs] Add separate migration section + instructions for moving to GtS and no... (diff) | |
download | gotosocial-8ab2b19a946251f258446d22f420d401f61d22f6.tar.xz |
[feature] Federate interaction policies + Accepts; enforce policies (#3138)
* [feature] Federate interaction policies + Accepts; enforce policies
* use Acceptable type
* fix index
* remove appendIRIStrs
* add GetAccept federatingdb function
* lock on object IRI
Diffstat (limited to 'internal/processing/status/fave.go')
-rw-r--r-- | internal/processing/status/fave.go | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/internal/processing/status/fave.go b/internal/processing/status/fave.go index 0f5a72b7d..497c4d465 100644 --- a/internal/processing/status/fave.go +++ b/internal/processing/status/fave.go @@ -103,8 +103,13 @@ func (p *Processor) FaveCreate( return nil, gtserror.NewErrorForbidden(err, errText) } - // Derive pendingApproval status. - var pendingApproval bool + // Derive pendingApproval + // and preapproved status. + var ( + pendingApproval bool + preApproved bool + ) + switch { case policyResult.WithApproval(): // We're allowed to do @@ -115,9 +120,18 @@ func (p *Processor) FaveCreate( // We're permitted to do this, but since // we matched due to presence in a followers // or following collection, we should mark - // as pending approval and wait for an accept. + // as pending approval and wait until we can + // prove it's been Accepted by the target. pendingApproval = true + if *status.Local { + // If the target is local we don't need + // to wait for an Accept from remote, + // we can just preapprove it and have + // the processor create the Accept. + preApproved = true + } + case policyResult.Permitted(): // We're permitted to do this // based on another kind of match. @@ -138,6 +152,7 @@ func (p *Processor) FaveCreate( StatusID: status.ID, Status: status, URI: uris.GenerateURIForLike(requester.Username, faveID), + PreApproved: preApproved, PendingApproval: &pendingApproval, } |