summaryrefslogtreecommitdiff
path: root/internal/db
diff options
context:
space:
mode:
Diffstat (limited to 'internal/db')
-rw-r--r--internal/db/bundb/domain.go4
-rw-r--r--internal/db/bundb/domain_test.go14
-rw-r--r--internal/db/bundb/domainpermissionsubscription_test.go2
-rw-r--r--internal/db/domain.go8
4 files changed, 14 insertions, 14 deletions
diff --git a/internal/db/bundb/domain.go b/internal/db/bundb/domain.go
index 925387bd9..23b9abc74 100644
--- a/internal/db/bundb/domain.go
+++ b/internal/db/bundb/domain.go
@@ -36,7 +36,7 @@ type domainDB struct {
state *state.State
}
-func (d *domainDB) CreateDomainAllow(ctx context.Context, allow *gtsmodel.DomainAllow) (err error) {
+func (d *domainDB) PutDomainAllow(ctx context.Context, allow *gtsmodel.DomainAllow) (err error) {
// Normalize the domain as punycode, note the extra
// validation step for domain name write operations.
allow.Domain, err = util.PunifySafely(allow.Domain)
@@ -162,7 +162,7 @@ func (d *domainDB) DeleteDomainAllow(ctx context.Context, domain string) error {
return nil
}
-func (d *domainDB) CreateDomainBlock(ctx context.Context, block *gtsmodel.DomainBlock) error {
+func (d *domainDB) PutDomainBlock(ctx context.Context, block *gtsmodel.DomainBlock) error {
var err error
// Normalize the domain as punycode, note the extra
diff --git a/internal/db/bundb/domain_test.go b/internal/db/bundb/domain_test.go
index 8164259e8..a56f469c4 100644
--- a/internal/db/bundb/domain_test.go
+++ b/internal/db/bundb/domain_test.go
@@ -46,7 +46,7 @@ func (suite *DomainTestSuite) TestIsDomainBlocked() {
suite.NoError(err)
suite.False(blocked)
- err = suite.db.CreateDomainBlock(ctx, domainBlock)
+ err = suite.db.PutDomainBlock(ctx, domainBlock)
suite.NoError(err)
// domain block now exists
@@ -75,7 +75,7 @@ func (suite *DomainTestSuite) TestIsDomainBlockedWithAllow() {
suite.False(blocked)
// Block this domain.
- if err := suite.db.CreateDomainBlock(ctx, domainBlock); err != nil {
+ if err := suite.db.PutDomainBlock(ctx, domainBlock); err != nil {
suite.FailNow(err.Error())
}
@@ -96,7 +96,7 @@ func (suite *DomainTestSuite) TestIsDomainBlockedWithAllow() {
CreatedByAccount: suite.testAccounts["admin_account"],
}
- if err := suite.db.CreateDomainAllow(ctx, domainAllow); err != nil {
+ if err := suite.db.PutDomainAllow(ctx, domainAllow); err != nil {
suite.FailNow(err.Error())
}
@@ -124,7 +124,7 @@ func (suite *DomainTestSuite) TestIsDomainBlockedWildcard() {
suite.NoError(err)
suite.False(blocked)
- err = suite.db.CreateDomainBlock(ctx, domainBlock)
+ err = suite.db.PutDomainBlock(ctx, domainBlock)
suite.NoError(err)
// Start with the base block domain
@@ -164,7 +164,7 @@ func (suite *DomainTestSuite) TestIsDomainBlockedNonASCII() {
suite.NoError(err)
suite.False(blocked)
- err = suite.db.CreateDomainBlock(ctx, domainBlock)
+ err = suite.db.PutDomainBlock(ctx, domainBlock)
suite.NoError(err)
// domain block now exists
@@ -200,7 +200,7 @@ func (suite *DomainTestSuite) TestIsDomainBlockedNonASCII2() {
suite.NoError(err)
suite.False(blocked)
- err = suite.db.CreateDomainBlock(ctx, domainBlock)
+ err = suite.db.PutDomainBlock(ctx, domainBlock)
suite.NoError(err)
// domain block now exists
@@ -232,7 +232,7 @@ func (suite *DomainTestSuite) TestIsOtherDomainBlockedWildcardAndExplicit() {
}
for _, block := range blocks {
- if err := suite.db.CreateDomainBlock(ctx, block); err != nil {
+ if err := suite.db.PutDomainBlock(ctx, block); err != nil {
suite.FailNow(err.Error())
}
}
diff --git a/internal/db/bundb/domainpermissionsubscription_test.go b/internal/db/bundb/domainpermissionsubscription_test.go
index 732befbff..7a5cf8685 100644
--- a/internal/db/bundb/domainpermissionsubscription_test.go
+++ b/internal/db/bundb/domainpermissionsubscription_test.go
@@ -80,7 +80,7 @@ func (suite *DomainPermissionSubscriptionTestSuite) TestCount() {
// Whack the perms in the db.
for _, perm := range perms {
- if err := suite.state.DB.CreateDomainBlock(ctx, perm); err != nil {
+ if err := suite.state.DB.PutDomainBlock(ctx, perm); err != nil {
suite.FailNow(err.Error())
}
}
diff --git a/internal/db/domain.go b/internal/db/domain.go
index 643538e7e..95a2f0755 100644
--- a/internal/db/domain.go
+++ b/internal/db/domain.go
@@ -31,8 +31,8 @@ type Domain interface {
Block/allow storage + retrieval functions.
*/
- // CreateDomainAllow puts the given instance-level domain allow into the database.
- CreateDomainAllow(ctx context.Context, allow *gtsmodel.DomainAllow) error
+ // PutDomainAllow puts the given instance-level domain allow into the database.
+ PutDomainAllow(ctx context.Context, allow *gtsmodel.DomainAllow) error
// GetDomainAllow returns one instance-level domain allow with the given domain, if it exists.
GetDomainAllow(ctx context.Context, domain string) (*gtsmodel.DomainAllow, error)
@@ -49,8 +49,8 @@ type Domain interface {
// DeleteDomainAllow deletes an instance-level domain allow with the given domain, if it exists.
DeleteDomainAllow(ctx context.Context, domain string) error
- // CreateDomainBlock puts the given instance-level domain block into the database.
- CreateDomainBlock(ctx context.Context, block *gtsmodel.DomainBlock) error
+ // PutDomainBlock puts the given instance-level domain block into the database.
+ PutDomainBlock(ctx context.Context, block *gtsmodel.DomainBlock) error
// GetDomainBlock returns one instance-level domain block with the given domain, if it exists.
GetDomainBlock(ctx context.Context, domain string) (*gtsmodel.DomainBlock, error)