mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-30 11:16:16 -06:00
modify 'freshest' freshness window to be 5s, add typeutils test for status -> api edits
This commit is contained in:
parent
c8a465f9a0
commit
a2d2443103
6 changed files with 240 additions and 10 deletions
|
|
@ -762,7 +762,7 @@ func (p *fediAPI) UpdateAccount(ctx context.Context, fMsg *messages.FromFediAPI)
|
|||
account,
|
||||
apubAcc,
|
||||
|
||||
// Force refresh within 10s window.
|
||||
// Force refresh within 5s window.
|
||||
//
|
||||
// Missing account updates could be
|
||||
// detrimental to federation if they
|
||||
|
|
@ -917,17 +917,25 @@ func (p *fediAPI) UpdateStatus(ctx context.Context, fMsg *messages.FromFediAPI)
|
|||
return gtserror.Newf("cannot cast %T -> *gtsmodel.Status", fMsg.GTSModel)
|
||||
}
|
||||
|
||||
var freshness *dereferencing.FreshnessWindow
|
||||
|
||||
// Cast the updated ActivityPub statusable object .
|
||||
apStatus, _ := fMsg.APObject.(ap.Statusable)
|
||||
|
||||
if apStatus != nil {
|
||||
// If an AP object was provided, we
|
||||
// allow very fast refreshes that likely
|
||||
// indicate a status edit after post.
|
||||
freshness = dereferencing.Freshest
|
||||
}
|
||||
|
||||
// Fetch up-to-date attach status attachments, etc.
|
||||
status, _, err := p.federate.RefreshStatus(
|
||||
ctx,
|
||||
fMsg.Receiving.Username,
|
||||
existing,
|
||||
apStatus,
|
||||
// Force refresh within 5min window.
|
||||
dereferencing.Fresh,
|
||||
freshness,
|
||||
)
|
||||
if err != nil {
|
||||
log.Errorf(ctx, "error refreshing status: %v", err)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue