summaryrefslogtreecommitdiff
path: root/internal/processing/workers/fromfediapi.go
diff options
context:
space:
mode:
authorLibravatar tobi <tobi.smethurst@protonmail.com>2026-01-22 13:14:27 +0100
committerLibravatar tobi <tobi.smethurst@protonmail.com>2026-01-22 13:28:23 +0100
commitc00f640f3dcf752c287e8c89c29831501cfc2a1a (patch)
tree02c913668683503f9f68aff3a41af06707f3088a /internal/processing/workers/fromfediapi.go
parent[chore] Update robots.txt md5 hashes for etags (#4623) (diff)
downloadgotosocial-c00f640f3dcf752c287e8c89c29831501cfc2a1a.tar.xz
[bugfix] Mark targets of pre-approved polite interaction requests as no longer pending approval (#4647)
Fix a little bug written by yours truly, where we weren't marking the targets of pre-approved ReplyRequests and AnnounceRequests as no longer pending approval. Only just found this now because of testing with polite requests. Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4647 Co-authored-by: tobi <tobi.smethurst@protonmail.com> Co-committed-by: tobi <tobi.smethurst@protonmail.com>
Diffstat (limited to 'internal/processing/workers/fromfediapi.go')
-rw-r--r--internal/processing/workers/fromfediapi.go45
1 files changed, 36 insertions, 9 deletions
diff --git a/internal/processing/workers/fromfediapi.go b/internal/processing/workers/fromfediapi.go
index f6feeb622..310ea32b6 100644
--- a/internal/processing/workers/fromfediapi.go
+++ b/internal/processing/workers/fromfediapi.go
@@ -473,6 +473,20 @@ func (p *fediAPI) CreateReplyRequest(ctx context.Context, fMsg *messages.FromFed
return gtserror.Newf("db error updating interaction request: %w", err)
}
+ // Mark the reply as now approved, referring to
+ // the accepted interaction request we just stored.
+ reply.PreApproved = false
+ reply.PendingApproval = util.Ptr(false)
+ reply.ApprovedByURI = req.AuthorizationURI
+ if err := p.state.DB.UpdateStatus(
+ ctx,
+ reply,
+ "pending_approval",
+ "approved_by_uri",
+ ); err != nil {
+ return gtserror.Newf("db error updating status: %w", err)
+ }
+
// Send out the accept.
if err := p.federate.AcceptInteraction(ctx, req); err != nil {
log.Errorf(ctx, "error federating accept: %v", err)
@@ -756,17 +770,11 @@ func (p *fediAPI) CreateLikeRequest(ctx context.Context, fMsg *messages.FromFedi
return gtserror.Newf("db error updating interaction request: %w", err)
}
- // Send out the accept.
- if err := p.federate.AcceptInteraction(ctx, req); err != nil {
- log.Errorf(ctx, "error federating accept: %v", err)
- }
-
- // Mark the fave as approved.
+ // Mark the status fave as now approved, referring to
+ // the accepted interaction request we just stored.
+ req.Like.PreApproved = false
req.Like.PendingApproval = util.Ptr(false)
req.Like.ApprovedByURI = req.AuthorizationURI
- req.Like.PreApproved = false
-
- // Update in the db.
if err := p.state.DB.UpdateStatusFave(
ctx,
req.Like,
@@ -776,6 +784,11 @@ func (p *fediAPI) CreateLikeRequest(ctx context.Context, fMsg *messages.FromFedi
return gtserror.Newf("db error updating status fave: %w", err)
}
+ // Send out the accept.
+ if err := p.federate.AcceptInteraction(ctx, req); err != nil {
+ log.Errorf(ctx, "error federating accept: %v", err)
+ }
+
// Notify the faved account.
if err := p.surface.notifyFave(ctx, req.Like); err != nil {
log.Errorf(ctx, "error notifying fave: %v", err)
@@ -979,6 +992,20 @@ func (p *fediAPI) CreateAnnounceRequest(ctx context.Context, fMsg *messages.From
return gtserror.Newf("db error updating interaction request: %w", err)
}
+ // Mark the boost as now approved, referring to
+ // the accepted interaction request we just stored.
+ boost.PreApproved = false
+ boost.PendingApproval = util.Ptr(false)
+ boost.ApprovedByURI = req.AuthorizationURI
+ if err := p.state.DB.UpdateStatus(
+ ctx,
+ boost,
+ "pending_approval",
+ "approved_by_uri",
+ ); err != nil {
+ return gtserror.Newf("db error updating status: %w", err)
+ }
+
// Send out the accept.
if err := p.federate.AcceptInteraction(ctx, req); err != nil {
log.Errorf(ctx, "error federating accept: %v", err)