summaryrefslogtreecommitdiff
path: root/internal/processing/fromcommon.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2021-10-01 19:08:50 +0200
committerLibravatar GitHub <noreply@github.com>2021-10-01 19:08:50 +0200
commit9ce4234b9fd1e201faf015df52bfc35db259dd46 (patch)
tree98c27c89aa018fafabf00e4e462f1af84208c760 /internal/processing/fromcommon.go
parentrework mention replacement func (#258) (diff)
downloadgotosocial-9ce4234b9fd1e201faf015df52bfc35db259dd46.tar.xz
Follow request auto approval (#259)
* start messing about * fiddle more * Tests & fiddling
Diffstat (limited to 'internal/processing/fromcommon.go')
-rw-r--r--internal/processing/fromcommon.go17
1 files changed, 14 insertions, 3 deletions
diff --git a/internal/processing/fromcommon.go b/internal/processing/fromcommon.go
index 88d7405a8..e14c36fd4 100644
--- a/internal/processing/fromcommon.go
+++ b/internal/processing/fromcommon.go
@@ -109,9 +109,20 @@ func (p *processor) notifyStatus(ctx context.Context, status *gtsmodel.Status) e
return nil
}
-func (p *processor) notifyFollowRequest(ctx context.Context, followRequest *gtsmodel.FollowRequest, receivingAccount *gtsmodel.Account) error {
+func (p *processor) notifyFollowRequest(ctx context.Context, followRequest *gtsmodel.FollowRequest) error {
+ // make sure we have the target account pinned on the follow request
+ if followRequest.TargetAccount == nil {
+ a, err := p.db.GetAccountByID(ctx, followRequest.TargetAccountID)
+ if err != nil {
+ return err
+ }
+ followRequest.TargetAccount = a
+ }
+ targetAccount := followRequest.TargetAccount
+
// return if this isn't a local account
- if receivingAccount.Domain != "" {
+ if targetAccount.Domain != "" {
+ // this isn't a local account so we've got nothing to do here
return nil
}
@@ -137,7 +148,7 @@ func (p *processor) notifyFollowRequest(ctx context.Context, followRequest *gtsm
return fmt.Errorf("notifyStatus: error converting notification to masto representation: %s", err)
}
- if err := p.streamingProcessor.StreamNotificationToAccount(mastoNotif, receivingAccount); err != nil {
+ if err := p.streamingProcessor.StreamNotificationToAccount(mastoNotif, targetAccount); err != nil {
return fmt.Errorf("notifyStatus: error streaming notification to account: %s", err)
}