From edcee14d07bae129e2d1a06d99c30fc6f659ff5e Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Fri, 11 Nov 2022 12:18:38 +0100 Subject: [feature] Read + Write tombstones for deleted Actors (#1005) * [feature] Read + Write tombstones for deleted Actors * copyTombstone * update to use resultcache instead of old ttl cache Signed-off-by: kim * update go-cache library to fix result cache capacity / ordering bugs Signed-off-by: kim * bump go-cache/v3 to v3.1.6 to fix bugs Signed-off-by: kim * switch on status code * better explain ErrGone reasoning Signed-off-by: kim Co-authored-by: kim --- testrig/transportcontroller.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'testrig/transportcontroller.go') diff --git a/testrig/transportcontroller.go b/testrig/transportcontroller.go index 70f2f0c61..18c3094d5 100644 --- a/testrig/transportcontroller.go +++ b/testrig/transportcontroller.go @@ -33,6 +33,7 @@ import ( "github.com/superseriousbusiness/gotosocial/internal/concurrency" "github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/federation" + "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/log" "github.com/superseriousbusiness/gotosocial/internal/messages" "github.com/superseriousbusiness/gotosocial/internal/transport" @@ -65,6 +66,7 @@ type MockHTTPClient struct { testRemoteServices map[string]vocab.ActivityStreamsService testRemoteAttachments map[string]RemoteAttachmentFile testRemoteEmojis map[string]vocab.TootEmoji + testTombstones map[string]*gtsmodel.Tombstone SentMessages sync.Map } @@ -92,6 +94,7 @@ func NewMockHTTPClient(do func(req *http.Request) (*http.Response, error), relat mockHTTPClient.testRemoteServices = NewTestFediServices() mockHTTPClient.testRemoteAttachments = NewTestFediAttachments(relativeMediaPath) mockHTTPClient.testRemoteEmojis = NewTestFediEmojis() + mockHTTPClient.testTombstones = NewTestTombstones() mockHTTPClient.do = func(req *http.Request) (*http.Response, error) { responseCode := http.StatusNotFound @@ -193,6 +196,11 @@ func NewMockHTTPClient(do func(req *http.Request) (*http.Response, error), relat responseBytes = attachment.Data responseContentType = attachment.ContentType responseContentLength = len(attachment.Data) + } else if _, ok := mockHTTPClient.testTombstones[req.URL.String()]; ok { + responseCode = http.StatusGone + responseBytes = []byte{} + responseContentType = "text/html" + responseContentLength = 0 } log.Debugf("returning response %s", string(responseBytes)) -- cgit v1.2.3