[feature] Allow admins to send test emails (#1620)

* [feature] Allow admins to send test emails

* implement unwrap on new error type

* add + use gtserror types

* GoToSocial Email Test -> GoToSocial Test Email

* add + use getInstance db call

* removed unused "unknown" error type
This commit is contained in:
tobi
2023-03-14 17:11:04 +01:00
committed by GitHub
parent d5529d6c9f
commit 196cd88b1c
17 changed files with 460 additions and 83 deletions

View File

@@ -97,6 +97,20 @@ func (i *instanceDB) CountInstanceDomains(ctx context.Context, domain string) (i
return count, nil
}
func (i *instanceDB) GetInstance(ctx context.Context, domain string) (*gtsmodel.Instance, db.Error) {
instance := &gtsmodel.Instance{}
if err := i.conn.
NewSelect().
Model(instance).
Where("? = ?", bun.Ident("instance.domain"), domain).
Scan(ctx); err != nil {
return nil, i.conn.ProcessError(err)
}
return instance, nil
}
func (i *instanceDB) GetInstancePeers(ctx context.Context, includeSuspended bool) ([]*gtsmodel.Instance, db.Error) {
instances := []*gtsmodel.Instance{}