mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[chore] Deinterface processor and subprocessors (#1501)
* [chore] Deinterface processor and subprocessors * expose subprocessors via function calls * missing license header
This commit is contained in:
@@ -115,7 +115,7 @@ func (m *Module) AccountActionPOSTHandler(c *gin.Context) {
|
||||
}
|
||||
form.TargetAccountID = targetAcctID
|
||||
|
||||
if errWithCode := m.processor.AdminAccountAction(c.Request.Context(), authed, form); errWithCode != nil {
|
||||
if errWithCode := m.processor.Admin().AccountAction(c.Request.Context(), authed.Account, form); errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
@@ -83,10 +83,10 @@ const (
|
||||
)
|
||||
|
||||
type Module struct {
|
||||
processor processing.Processor
|
||||
processor *processing.Processor
|
||||
}
|
||||
|
||||
func New(processor processing.Processor) *Module {
|
||||
func New(processor *processing.Processor) *Module {
|
||||
return &Module{
|
||||
processor: processor,
|
||||
}
|
||||
|
@@ -48,7 +48,7 @@ type AdminStandardTestSuite struct {
|
||||
storage *storage.Driver
|
||||
mediaManager media.Manager
|
||||
federator federation.Federator
|
||||
processor processing.Processor
|
||||
processor *processing.Processor
|
||||
emailSender email.Sender
|
||||
sentEmails map[string]string
|
||||
|
||||
|
@@ -167,7 +167,7 @@ func (m *Module) DomainBlocksPOSTHandler(c *gin.Context) {
|
||||
|
||||
if imp {
|
||||
// we're importing multiple blocks
|
||||
domainBlocks, errWithCode := m.processor.AdminDomainBlocksImport(c.Request.Context(), authed, form)
|
||||
domainBlocks, errWithCode := m.processor.Admin().DomainBlocksImport(c.Request.Context(), authed.Account, form.Domains)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
@@ -177,7 +177,7 @@ func (m *Module) DomainBlocksPOSTHandler(c *gin.Context) {
|
||||
}
|
||||
|
||||
// we're just creating one block
|
||||
domainBlock, errWithCode := m.processor.AdminDomainBlockCreate(c.Request.Context(), authed, form)
|
||||
domainBlock, errWithCode := m.processor.Admin().DomainBlockCreate(c.Request.Context(), authed.Account, form.Domain, form.Obfuscate, form.PublicComment, form.PrivateComment, "")
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
|
@@ -94,7 +94,7 @@ func (m *Module) DomainBlockDELETEHandler(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
domainBlock, errWithCode := m.processor.AdminDomainBlockDelete(c.Request.Context(), authed, domainBlockID)
|
||||
domainBlock, errWithCode := m.processor.Admin().DomainBlockDelete(c.Request.Context(), authed.Account, domainBlockID)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
|
@@ -107,7 +107,7 @@ func (m *Module) DomainBlockGETHandler(c *gin.Context) {
|
||||
export = i
|
||||
}
|
||||
|
||||
domainBlock, errWithCode := m.processor.AdminDomainBlockGet(c.Request.Context(), authed, domainBlockID, export)
|
||||
domainBlock, errWithCode := m.processor.Admin().DomainBlockGet(c.Request.Context(), authed.Account, domainBlockID, export)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
|
@@ -105,7 +105,7 @@ func (m *Module) DomainBlocksGETHandler(c *gin.Context) {
|
||||
export = i
|
||||
}
|
||||
|
||||
domainBlocks, errWithCode := m.processor.AdminDomainBlocksGet(c.Request.Context(), authed, export)
|
||||
domainBlocks, errWithCode := m.processor.Admin().DomainBlocksGet(c.Request.Context(), authed.Account, export)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
|
@@ -84,7 +84,7 @@ func (m *Module) EmojiCategoriesGETHandler(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
categories, errWithCode := m.processor.AdminEmojiCategoriesGet(c.Request.Context())
|
||||
categories, errWithCode := m.processor.Admin().EmojiCategoriesGet(c.Request.Context())
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
|
@@ -126,7 +126,7 @@ func (m *Module) EmojiCreatePOSTHandler(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
apiEmoji, errWithCode := m.processor.AdminEmojiCreate(c.Request.Context(), authed, form)
|
||||
apiEmoji, errWithCode := m.processor.Admin().EmojiCreate(c.Request.Context(), authed.Account, authed.User, form)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
|
@@ -100,7 +100,7 @@ func (m *Module) EmojiDELETEHandler(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
emoji, errWithCode := m.processor.AdminEmojiDelete(c.Request.Context(), authed, emojiID)
|
||||
emoji, errWithCode := m.processor.Admin().EmojiDelete(c.Request.Context(), emojiID)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
|
@@ -90,7 +90,7 @@ func (m *Module) EmojiGETHandler(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
emoji, errWithCode := m.processor.AdminEmojiGet(c.Request.Context(), authed, emojiID)
|
||||
emoji, errWithCode := m.processor.Admin().EmojiGet(c.Request.Context(), authed.Account, authed.User, emojiID)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
|
@@ -198,7 +198,7 @@ func (m *Module) EmojisGETHandler(c *gin.Context) {
|
||||
includeEnabled = true
|
||||
}
|
||||
|
||||
resp, errWithCode := m.processor.AdminEmojisGet(c.Request.Context(), authed, domain, includeDisabled, includeEnabled, shortcode, maxShortcodeDomain, minShortcodeDomain, limit)
|
||||
resp, errWithCode := m.processor.Admin().EmojisGet(c.Request.Context(), authed.Account, authed.User, domain, includeDisabled, includeEnabled, shortcode, maxShortcodeDomain, minShortcodeDomain, limit)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
|
@@ -156,7 +156,7 @@ func (m *Module) EmojiPATCHHandler(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
emoji, errWithCode := m.processor.AdminEmojiUpdate(c.Request.Context(), emojiID, form)
|
||||
emoji, errWithCode := m.processor.Admin().EmojiUpdate(c.Request.Context(), emojiID, form)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
|
@@ -98,7 +98,7 @@ func (m *Module) MediaCleanupPOSTHandler(c *gin.Context) {
|
||||
remoteCacheDays = 0
|
||||
}
|
||||
|
||||
if errWithCode := m.processor.AdminMediaPrune(c.Request.Context(), remoteCacheDays); errWithCode != nil {
|
||||
if errWithCode := m.processor.Admin().MediaPrune(c.Request.Context(), remoteCacheDays); errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
@@ -84,7 +84,7 @@ func (m *Module) MediaRefetchPOSTHandler(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
if errWithCode := m.processor.AdminMediaRefetch(c.Request.Context(), authed, c.Query(DomainQueryKey)); errWithCode != nil {
|
||||
if errWithCode := m.processor.Admin().MediaRefetch(c.Request.Context(), authed.Account, c.Query(DomainQueryKey)); errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
}
|
||||
|
@@ -93,7 +93,7 @@ func (m *Module) ReportGETHandler(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
report, errWithCode := m.processor.AdminReportGet(c.Request.Context(), authed, reportID)
|
||||
report, errWithCode := m.processor.Admin().ReportGet(c.Request.Context(), authed.Account, reportID)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
|
@@ -115,7 +115,7 @@ func (m *Module) ReportResolvePOSTHandler(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
report, errWithCode := m.processor.AdminReportResolve(c.Request.Context(), authed, reportID, form.ActionTakenComment)
|
||||
report, errWithCode := m.processor.Admin().ReportResolve(c.Request.Context(), authed.Account, reportID, form.ActionTakenComment)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
|
@@ -171,7 +171,7 @@ func (m *Module) ReportsGETHandler(c *gin.Context) {
|
||||
limit = i
|
||||
}
|
||||
|
||||
resp, errWithCode := m.processor.AdminReportsGet(c.Request.Context(), authed, resolved, c.Query(AccountIDKey), c.Query(TargetAccountIDKey), c.Query(MaxIDKey), c.Query(SinceIDKey), c.Query(MinIDKey), limit)
|
||||
resp, errWithCode := m.processor.Admin().ReportsGet(c.Request.Context(), authed.Account, resolved, c.Query(AccountIDKey), c.Query(TargetAccountIDKey), c.Query(MaxIDKey), c.Query(SinceIDKey), c.Query(MinIDKey), limit)
|
||||
if errWithCode != nil {
|
||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||
return
|
||||
|
Reference in New Issue
Block a user