move stuff around + further work on domain blocks

This commit is contained in:
tsmethurst 2021-06-28 19:45:38 +02:00
commit 5e2ba03adc
29 changed files with 279 additions and 50 deletions

View file

@ -76,6 +76,8 @@ type TypeConverter interface {
RelationshipToMasto(r *gtsmodel.Relationship) (*model.Relationship, error)
// NotificationToMasto converts a gts notification into a mastodon notification
NotificationToMasto(n *gtsmodel.Notification) (*model.Notification, error)
// DomainBlockTomasto converts a gts model domin block into a mastodon domain block, for serving at /api/v1/admin/domain_blocks
DomainBlockToMasto(b *gtsmodel.DomainBlock) (*model.DomainBlock, error)
/*
FRONTEND (mastodon) MODEL TO INTERNAL (gts) MODEL

View file

@ -644,3 +644,16 @@ func (c *converter) NotificationToMasto(n *gtsmodel.Notification) (*model.Notifi
Status: mastoStatus,
}, nil
}
func (c *converter) DomainBlockToMasto(b *gtsmodel.DomainBlock) (*model.DomainBlock, error) {
return &model.DomainBlock{
ID: b.ID,
Domain: b.Domain,
Obfuscate: b.Obfuscate,
PrivateComment: b.PrivateComment,
PublicComment: b.PublicComment,
SubscriptionID: b.SubscriptionID,
CreatedBy: b.CreatedByAccountID,
CreatedAt: b.CreatedAt.Format(time.RFC3339),
}, nil
}