mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-05-31 22:58:32 +00:00
put move origin account on fMsg
This commit is contained in:
parent
6b91996183
commit
c6948b8f4a
|
@ -296,10 +296,11 @@ func (f *federatingDB) Move(ctx context.Context, move vocab.ActivityStreamsMove)
|
|||
// We had a Move already or stored a new Move.
|
||||
// Pass back to a worker for async processing.
|
||||
f.state.Workers.EnqueueFediAPI(ctx, messages.FromFediAPI{
|
||||
APObjectType: ap.ObjectProfile,
|
||||
APActivityType: ap.ActivityMove,
|
||||
GTSModel: gtsMove,
|
||||
ReceivingAccount: receivingAcct,
|
||||
APObjectType: ap.ObjectProfile,
|
||||
APActivityType: ap.ActivityMove,
|
||||
GTSModel: gtsMove,
|
||||
RequestingAccount: requestingAcct,
|
||||
ReceivingAccount: receivingAcct,
|
||||
})
|
||||
|
||||
return nil
|
||||
|
|
|
@ -34,10 +34,11 @@ type FromClientAPI struct {
|
|||
|
||||
// FromFediAPI wraps a message that travels from the federating API into the processor.
|
||||
type FromFediAPI struct {
|
||||
APObjectType string
|
||||
APActivityType string
|
||||
APIri *url.URL
|
||||
APObjectModel interface{} // Optional AP model of the Object of the Activity. Should be Accountable or Statusable.
|
||||
GTSModel interface{} // Optional GTS model of the Activity or Object.
|
||||
ReceivingAccount *gtsmodel.Account // Local account which owns the inbox that this Activity was posted to.
|
||||
APObjectType string
|
||||
APActivityType string
|
||||
APIri *url.URL
|
||||
APObjectModel interface{} // Optional AP model of the Object of the Activity. Should be Accountable or Statusable.
|
||||
GTSModel interface{} // Optional GTS model of the Activity or Object.
|
||||
RequestingAccount *gtsmodel.Account // Remote account that posted this Activity to the inbox.
|
||||
ReceivingAccount *gtsmodel.Account // Local account which owns the inbox that this Activity was posted to.
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ func (p *fediAPI) MoveAccount(ctx context.Context, fMsg messages.FromFediAPI) er
|
|||
// Move origin and target info.
|
||||
var (
|
||||
originAcctURIStr = move.OriginURI
|
||||
originAcctURI = move.Origin
|
||||
originAcct = fMsg.RequestingAccount
|
||||
targetAcctURIStr = move.TargetURI
|
||||
targetAcctURI = move.Target
|
||||
)
|
||||
|
@ -83,42 +83,6 @@ func (p *fediAPI) MoveAccount(ctx context.Context, fMsg messages.FromFediAPI) er
|
|||
)
|
||||
defer unlock()
|
||||
|
||||
// Fetch the Move originAcct. Likely just got
|
||||
// put in cache by delivering to the inbox.
|
||||
originAcct, originAcctable, err := p.federate.GetAccountByURI(
|
||||
ctx,
|
||||
receiver.Username,
|
||||
originAcctURI,
|
||||
)
|
||||
if err != nil {
|
||||
return gtserror.Newf(
|
||||
"error getting origin account %s: %w",
|
||||
originAcctURIStr, err,
|
||||
)
|
||||
}
|
||||
|
||||
// Hard force refresh Move origin account to
|
||||
// ensure we most have up-to-date version.
|
||||
//
|
||||
// Note that it's possible for originAcct.MovedTo
|
||||
// to be set to targetAcctURI already without us
|
||||
// having actually processed the Move yet, if we
|
||||
// manage to refresh originAcct here (or further
|
||||
// upstream) *before* an Account Update is sent to
|
||||
// us from their instance.
|
||||
originAcct, _, err = p.federate.RefreshAccount(ctx,
|
||||
receiver.Username,
|
||||
originAcct,
|
||||
originAcctable,
|
||||
dereferencing.Freshest,
|
||||
)
|
||||
if err != nil {
|
||||
return gtserror.Newf(
|
||||
"error refreshing origin account %s: %w",
|
||||
originAcctURIStr, err,
|
||||
)
|
||||
}
|
||||
|
||||
// If movedToURI is set on originAcct, make
|
||||
// sure it's actually to the intended target.
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue