mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2026-01-07 10:03:17 -06:00
rename target => receiving account
This commit is contained in:
parent
3965ae0d3f
commit
84616b07ff
8 changed files with 42 additions and 57 deletions
|
|
@ -48,12 +48,9 @@ func (f *federatingDB) Accept(ctx context.Context, accept vocab.ActivityStreamsA
|
|||
l.Debug("entering Accept")
|
||||
}
|
||||
|
||||
targetAcct, fromFederatorChan, err := extractFromCtx(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if targetAcct == nil || fromFederatorChan == nil {
|
||||
// If the target account or federator channel wasn't set on the context, that means this request didn't pass
|
||||
receivingAccount, _, fromFederatorChan := extractFromCtx(ctx)
|
||||
if receivingAccount == nil || fromFederatorChan == nil {
|
||||
// If the receiving account or federator channel wasn't set on the context, that means this request didn't pass
|
||||
// through the API, but came from inside GtS as the result of another activity on this instance. That being so,
|
||||
// we can safely just ignore this activity, since we know we've already processed it elsewhere.
|
||||
return nil
|
||||
|
|
@ -77,7 +74,7 @@ func (f *federatingDB) Accept(ctx context.Context, accept vocab.ActivityStreamsA
|
|||
}
|
||||
|
||||
// make sure the addressee of the original follow is the same as whatever inbox this landed in
|
||||
if gtsFollowRequest.AccountID != targetAcct.ID {
|
||||
if gtsFollowRequest.AccountID != receivingAccount.ID {
|
||||
return errors.New("ACCEPT: follow object account and inbox account were not the same")
|
||||
}
|
||||
follow, err := f.db.AcceptFollowRequest(ctx, gtsFollowRequest.AccountID, gtsFollowRequest.TargetAccountID)
|
||||
|
|
@ -89,7 +86,7 @@ func (f *federatingDB) Accept(ctx context.Context, accept vocab.ActivityStreamsA
|
|||
APObjectType: ap.ActivityFollow,
|
||||
APActivityType: ap.ActivityAccept,
|
||||
GTSModel: follow,
|
||||
ReceivingAccount: targetAcct,
|
||||
ReceivingAccount: receivingAccount,
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
@ -114,7 +111,7 @@ func (f *federatingDB) Accept(ctx context.Context, accept vocab.ActivityStreamsA
|
|||
return fmt.Errorf("ACCEPT: error converting asfollow to gtsfollow: %s", err)
|
||||
}
|
||||
// make sure the addressee of the original follow is the same as whatever inbox this landed in
|
||||
if gtsFollow.AccountID != targetAcct.ID {
|
||||
if gtsFollow.AccountID != receivingAccount.ID {
|
||||
return errors.New("ACCEPT: follow object account and inbox account were not the same")
|
||||
}
|
||||
follow, err := f.db.AcceptFollowRequest(ctx, gtsFollow.AccountID, gtsFollow.TargetAccountID)
|
||||
|
|
@ -126,7 +123,7 @@ func (f *federatingDB) Accept(ctx context.Context, accept vocab.ActivityStreamsA
|
|||
APObjectType: ap.ActivityFollow,
|
||||
APActivityType: ap.ActivityAccept,
|
||||
GTSModel: follow,
|
||||
ReceivingAccount: targetAcct,
|
||||
ReceivingAccount: receivingAccount,
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -44,12 +44,9 @@ func (f *federatingDB) Announce(ctx context.Context, announce vocab.ActivityStre
|
|||
l.Debug("entering Announce")
|
||||
}
|
||||
|
||||
targetAcct, fromFederatorChan, err := extractFromCtx(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if targetAcct == nil || fromFederatorChan == nil {
|
||||
// If the target account or federator channel wasn't set on the context, that means this request didn't pass
|
||||
receivingAccount, _, fromFederatorChan := extractFromCtx(ctx)
|
||||
if receivingAccount == nil || fromFederatorChan == nil {
|
||||
// If the receiving account or federator channel wasn't set on the context, that means this request didn't pass
|
||||
// through the API, but came from inside GtS as the result of another activity on this instance. That being so,
|
||||
// we can safely just ignore this activity, since we know we've already processed it elsewhere.
|
||||
return nil
|
||||
|
|
@ -57,7 +54,7 @@ func (f *federatingDB) Announce(ctx context.Context, announce vocab.ActivityStre
|
|||
|
||||
boost, isNew, err := f.typeConverter.ASAnnounceToStatus(ctx, announce)
|
||||
if err != nil {
|
||||
return fmt.Errorf("ANNOUNCE: error converting announce to boost: %s", err)
|
||||
return fmt.Errorf("Announce: error converting announce to boost: %s", err)
|
||||
}
|
||||
|
||||
if !isNew {
|
||||
|
|
@ -70,7 +67,7 @@ func (f *federatingDB) Announce(ctx context.Context, announce vocab.ActivityStre
|
|||
APObjectType: ap.ActivityAnnounce,
|
||||
APActivityType: ap.ActivityCreate,
|
||||
GTSModel: boost,
|
||||
ReceivingAccount: targetAcct,
|
||||
ReceivingAccount: receivingAccount,
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -44,12 +44,9 @@ func (f *federatingDB) Delete(ctx context.Context, id *url.URL) error {
|
|||
)
|
||||
l.Debug("entering Delete")
|
||||
|
||||
targetAcct, fromFederatorChan, err := extractFromCtx(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if targetAcct == nil || fromFederatorChan == nil {
|
||||
// If the target account or federator channel wasn't set on the context, that means this request didn't pass
|
||||
receivingAccount, _, fromFederatorChan := extractFromCtx(ctx)
|
||||
if receivingAccount == nil || fromFederatorChan == nil {
|
||||
// If the receiving account or federator channel wasn't set on the context, that means this request didn't pass
|
||||
// through the API, but came from inside GtS as the result of another activity on this instance. That being so,
|
||||
// we can safely just ignore this activity, since we know we've already processed it elsewhere.
|
||||
return nil
|
||||
|
|
@ -68,7 +65,7 @@ func (f *federatingDB) Delete(ctx context.Context, id *url.URL) error {
|
|||
APObjectType: ap.ObjectNote,
|
||||
APActivityType: ap.ActivityDelete,
|
||||
GTSModel: s,
|
||||
ReceivingAccount: targetAcct,
|
||||
ReceivingAccount: receivingAccount,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -80,7 +77,7 @@ func (f *federatingDB) Delete(ctx context.Context, id *url.URL) error {
|
|||
APObjectType: ap.ObjectProfile,
|
||||
APActivityType: ap.ActivityDelete,
|
||||
GTSModel: a,
|
||||
ReceivingAccount: targetAcct,
|
||||
ReceivingAccount: receivingAccount,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,12 +46,9 @@ func (f *federatingDB) Undo(ctx context.Context, undo vocab.ActivityStreamsUndo)
|
|||
l.Debug("entering Undo")
|
||||
}
|
||||
|
||||
targetAcct, fromFederatorChan, err := extractFromCtx(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if targetAcct == nil || fromFederatorChan == nil {
|
||||
// If the target account or federator channel wasn't set on the context, that means this request didn't pass
|
||||
receivingAccount, _, fromFederatorChan := extractFromCtx(ctx)
|
||||
if receivingAccount == nil || fromFederatorChan == nil {
|
||||
// If the receiving account or federator channel wasn't set on the context, that means this request didn't pass
|
||||
// through the API, but came from inside GtS as the result of another activity on this instance. That being so,
|
||||
// we can safely just ignore this activity, since we know we've already processed it elsewhere.
|
||||
return nil
|
||||
|
|
@ -83,7 +80,7 @@ func (f *federatingDB) Undo(ctx context.Context, undo vocab.ActivityStreamsUndo)
|
|||
return fmt.Errorf("UNDO: error converting asfollow to gtsfollow: %s", err)
|
||||
}
|
||||
// make sure the addressee of the original follow is the same as whatever inbox this landed in
|
||||
if gtsFollow.TargetAccountID != targetAcct.ID {
|
||||
if gtsFollow.TargetAccountID != receivingAccount.ID {
|
||||
return errors.New("UNDO: follow object account and inbox account were not the same")
|
||||
}
|
||||
// delete any existing FOLLOW
|
||||
|
|
@ -116,7 +113,7 @@ func (f *federatingDB) Undo(ctx context.Context, undo vocab.ActivityStreamsUndo)
|
|||
return fmt.Errorf("UNDO: error converting asblock to gtsblock: %s", err)
|
||||
}
|
||||
// make sure the addressee of the original block is the same as whatever inbox this landed in
|
||||
if gtsBlock.TargetAccountID != targetAcct.ID {
|
||||
if gtsBlock.TargetAccountID != receivingAccount.ID {
|
||||
return errors.New("UNDO: block object account and inbox account were not the same")
|
||||
}
|
||||
// delete any existing BLOCK
|
||||
|
|
|
|||
|
|
@ -56,12 +56,9 @@ func (f *federatingDB) Update(ctx context.Context, asType vocab.Type) error {
|
|||
l.Debug("entering Update")
|
||||
}
|
||||
|
||||
targetAcct, fromFederatorChan, err := extractFromCtx(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if targetAcct == nil || fromFederatorChan == nil {
|
||||
// If the target account or federator channel wasn't set on the context, that means this request didn't pass
|
||||
receivingAccount, _, fromFederatorChan := extractFromCtx(ctx)
|
||||
if receivingAccount == nil || fromFederatorChan == nil {
|
||||
// If the receiving account or federator channel wasn't set on the context, that means this request didn't pass
|
||||
// through the API, but came from inside GtS as the result of another activity on this instance. That being so,
|
||||
// we can safely just ignore this activity, since we know we've already processed it elsewhere.
|
||||
return nil
|
||||
|
|
@ -153,7 +150,7 @@ func (f *federatingDB) Update(ctx context.Context, asType vocab.Type) error {
|
|||
APObjectType: ap.ObjectProfile,
|
||||
APActivityType: ap.ActivityUpdate,
|
||||
GTSModel: updatedAcct,
|
||||
ReceivingAccount: targetAcct,
|
||||
ReceivingAccount: receivingAccount,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue