mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
Follow request auto approval (#259)
* start messing about * fiddle more * Tests & fiddling
This commit is contained in:
@ -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)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user