[bugfix] Ensure Account and TargetAccount set when doing UndoFollow (#4118)

Closes https://codeberg.org/superseriousbusiness/gotosocial/issues/4112 by ensuring that Account and TargetAccount are properly set on the follow passed through to UndoFollow.

Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4118
Co-authored-by: tobi <tobi.smethurst@protonmail.com>
Co-committed-by: tobi <tobi.smethurst@protonmail.com>
This commit is contained in:
tobi
2025-05-03 10:10:23 +00:00
committed by tobi
parent bad427e7f0
commit c15002d76e

View File

@@ -258,13 +258,9 @@ func (p *Processor) unfollow(ctx context.Context, requestingAccount *gtsmodel.Ac
msgs = append(msgs, &messages.FromClientAPI{ msgs = append(msgs, &messages.FromClientAPI{
APObjectType: ap.ActivityFollow, APObjectType: ap.ActivityFollow,
APActivityType: ap.ActivityUndo, APActivityType: ap.ActivityUndo,
GTSModel: &gtsmodel.Follow{ GTSModel: follow,
AccountID: requestingAccount.ID, Origin: requestingAccount,
TargetAccountID: targetAccount.ID, Target: targetAccount,
URI: follow.URI,
},
Origin: requestingAccount,
Target: targetAccount,
}) })
} }
@@ -294,9 +290,13 @@ func (p *Processor) unfollow(ctx context.Context, requestingAccount *gtsmodel.Ac
msgs = append(msgs, &messages.FromClientAPI{ msgs = append(msgs, &messages.FromClientAPI{
APObjectType: ap.ActivityFollow, APObjectType: ap.ActivityFollow,
APActivityType: ap.ActivityUndo, APActivityType: ap.ActivityUndo,
// Dummy out a follow to undo,
// based on the follow request.
GTSModel: &gtsmodel.Follow{ GTSModel: &gtsmodel.Follow{
AccountID: requestingAccount.ID, AccountID: requestingAccount.ID,
Account: requestingAccount,
TargetAccountID: targetAccount.ID, TargetAccountID: targetAccount.ID,
TargetAccount: targetAccount,
URI: followReq.URI, URI: followReq.URI,
}, },
Origin: requestingAccount, Origin: requestingAccount,