blob: 3d9fe3b84a5fb885e2765afddb2e015ac12d337a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
package federation
import (
"context"
"fmt"
"net/url"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
"github.com/superseriousbusiness/gotosocial/internal/id"
"github.com/superseriousbusiness/gotosocial/internal/log"
)
// CheckGone checks if a tombstone exists in the database for AP Actor or Object with the given uri.
func (f *federator) CheckGone(ctx context.Context, uri *url.URL) (bool, error) {
return f.db.TombstoneExistsWithURI(ctx, uri.String())
}
// HandleGone puts a tombstone in the database, which marks an AP Actor or Object with the given uri as gone.
func (f *federator) HandleGone(ctx context.Context, uri *url.URL) error {
tombstoneID, err := id.NewULID()
if err != nil {
err = fmt.Errorf("HandleGone: error generating id for new tombstone %s: %s", uri, err)
log.Error(err)
return err
}
tombstone := >smodel.Tombstone{
ID: tombstoneID,
Domain: uri.Host,
URI: uri.String(),
}
return f.db.PutTombstone(ctx, tombstone)
}
|