mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-19 13:23:03 -06:00
domain blocky block block
This commit is contained in:
parent
72a2bef878
commit
6f20eaee75
16 changed files with 193 additions and 29 deletions
|
|
@ -77,7 +77,7 @@ type TypeConverter interface {
|
|||
// 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)
|
||||
DomainBlockToMasto(b *gtsmodel.DomainBlock, export bool) (*model.DomainBlock, error)
|
||||
|
||||
/*
|
||||
FRONTEND (mastodon) MODEL TO INTERNAL (gts) MODEL
|
||||
|
|
|
|||
|
|
@ -645,15 +645,22 @@ func (c *converter) NotificationToMasto(n *gtsmodel.Notification) (*model.Notifi
|
|||
}, nil
|
||||
}
|
||||
|
||||
func (c *converter) DomainBlockToMasto(b *gtsmodel.DomainBlock) (*model.DomainBlock, error) {
|
||||
return &model.DomainBlock{
|
||||
ID: b.ID,
|
||||
func (c *converter) DomainBlockToMasto(b *gtsmodel.DomainBlock, export bool) (*model.DomainBlock, error) {
|
||||
|
||||
domainBlock := &model.DomainBlock{
|
||||
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
|
||||
}
|
||||
|
||||
// if we're exporting a domain block, return it with minimal information attached
|
||||
if !export {
|
||||
domainBlock.ID = b.ID
|
||||
domainBlock.Obfuscate = b.Obfuscate
|
||||
domainBlock.PrivateComment = b.PrivateComment
|
||||
domainBlock.SubscriptionID = b.SubscriptionID
|
||||
domainBlock.CreatedBy = b.CreatedByAccountID
|
||||
domainBlock.CreatedAt = b.CreatedAt.Format(time.RFC3339)
|
||||
}
|
||||
|
||||
return domainBlock, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue