mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-30 05:36:15 -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
36
internal/processing/status/edit_test.go
Normal file
36
internal/processing/status/edit_test.go
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
// GoToSocial
|
||||
// Copyright (C) GoToSocial Authors admin@gotosocial.org
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package status_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/suite"
|
||||
)
|
||||
|
||||
type StatusEditTestSuite struct {
|
||||
StatusStandardTestSuite
|
||||
}
|
||||
|
||||
func (suite *StatusEditTestSuite) TestEdit() {
|
||||
suite.T().Fatal("TODO")
|
||||
}
|
||||
|
||||
func TestStatusEditTestSuite(t *testing.T) {
|
||||
suite.Run(t, new(StatusEditTestSuite))
|
||||
}
|
||||
|
|
@ -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