[bugfix] Fix new domain block date (#893)

This commit is contained in:
tobi 2022-10-06 12:48:17 +02:00 committed by GitHub
commit 5cf0f9950a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 14 deletions

View file

@ -47,7 +47,7 @@ func normalizeDomain(domain string) (out string, err error) {
return out, err
}
func (d *domainDB) CreateDomainBlock(ctx context.Context, block gtsmodel.DomainBlock) db.Error {
func (d *domainDB) CreateDomainBlock(ctx context.Context, block *gtsmodel.DomainBlock) db.Error {
domain, err := normalizeDomain(block.Domain)
if err != nil {
return err
@ -56,13 +56,13 @@ func (d *domainDB) CreateDomainBlock(ctx context.Context, block gtsmodel.DomainB
// Attempt to insert new domain block
if _, err := d.conn.NewInsert().
Model(&block).
Exec(ctx, &block); err != nil {
Model(block).
Exec(ctx); err != nil {
return d.conn.ProcessError(err)
}
// Cache this domain block
d.cache.Put(block.Domain, &block)
d.cache.Put(block.Domain, block)
return nil
}