[chore] Deinterface processor and subprocessors (#1501)

* [chore] Deinterface processor and subprocessors

* expose subprocessors via function calls

* missing license header
This commit is contained in:
tobi 2023-02-22 16:05:26 +01:00 committed by GitHub
parent adb596600b
commit b6fbdc66c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
246 changed files with 2545 additions and 4549 deletions

View file

@ -59,7 +59,7 @@ func (a *ActivityPub) RoutePublicKey(r router.Router, m ...gin.HandlerFunc) {
a.publicKey.Route(publicKeyGroup.Handle)
}
func NewActivityPub(db db.DB, p processing.Processor) *ActivityPub {
func NewActivityPub(db db.DB, p *processing.Processor) *ActivityPub {
return &ActivityPub{
emoji: emoji.New(p),
users: users.New(p),

View file

@ -33,10 +33,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,
}

View file

@ -43,7 +43,7 @@ func (m *Module) EmojiGetHandler(c *gin.Context) {
return
}
resp, errWithCode := m.processor.GetFediEmoji(apiutil.TransferSignatureContext(c), requestedEmojiID, c.Request.URL)
resp, errWithCode := m.processor.Fedi().EmojiGet(apiutil.TransferSignatureContext(c), requestedEmojiID, c.Request.URL)
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return

View file

@ -48,7 +48,7 @@ type EmojiGetTestSuite struct {
mediaManager media.Manager
federator federation.Federator
emailSender email.Sender
processor processing.Processor
processor *processing.Processor
storage *storage.Driver
testEmojis map[string]*gtsmodel.Emoji

View file

@ -34,10 +34,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,
}

View file

@ -55,7 +55,7 @@ func (m *Module) PublicKeyGETHandler(c *gin.Context) {
return
}
resp, errWithCode := m.processor.GetFediUser(apiutil.TransferSignatureContext(c), requestedUsername, c.Request.URL)
resp, errWithCode := m.processor.Fedi().UserGet(apiutil.TransferSignatureContext(c), requestedUsername, c.Request.URL)
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return

View file

@ -51,7 +51,7 @@ func (m *Module) FollowersGETHandler(c *gin.Context) {
return
}
resp, errWithCode := m.processor.GetFediFollowers(apiutil.TransferSignatureContext(c), requestedUsername, c.Request.URL)
resp, errWithCode := m.processor.Fedi().FollowersGet(apiutil.TransferSignatureContext(c), requestedUsername, c.Request.URL)
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return

View file

@ -51,7 +51,7 @@ func (m *Module) FollowingGETHandler(c *gin.Context) {
return
}
resp, errWithCode := m.processor.GetFediFollowing(apiutil.TransferSignatureContext(c), requestedUsername, c.Request.URL)
resp, errWithCode := m.processor.Fedi().FollowingGet(apiutil.TransferSignatureContext(c), requestedUsername, c.Request.URL)
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return

View file

@ -38,7 +38,7 @@ func (m *Module) InboxPOSTHandler(c *gin.Context) {
return
}
if posted, err := m.processor.InboxPost(apiutil.TransferSignatureContext(c), c.Writer, c.Request); err != nil {
if posted, err := m.processor.Fedi().InboxPost(apiutil.TransferSignatureContext(c), c.Writer, c.Request); err != nil {
if withCode, ok := err.(gtserror.WithCode); ok {
apiutil.ErrorHandler(c, withCode, m.processor.InstanceGetV1)
} else {

View file

@ -129,7 +129,7 @@ func (m *Module) OutboxGETHandler(c *gin.Context) {
maxID = maxIDString
}
resp, errWithCode := m.processor.GetFediOutbox(apiutil.TransferSignatureContext(c), requestedUsername, page, maxID, minID, c.Request.URL)
resp, errWithCode := m.processor.Fedi().OutboxGet(apiutil.TransferSignatureContext(c), requestedUsername, page, maxID, minID, c.Request.URL)
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return

View file

@ -150,7 +150,7 @@ func (m *Module) StatusRepliesGETHandler(c *gin.Context) {
minID = minIDString
}
resp, errWithCode := m.processor.GetFediStatusReplies(apiutil.TransferSignatureContext(c), requestedUsername, requestedStatusID, page, onlyOtherAccounts, minID, c.Request.URL)
resp, errWithCode := m.processor.Fedi().StatusRepliesGet(apiutil.TransferSignatureContext(c), requestedUsername, requestedStatusID, page, onlyOtherAccounts, minID, c.Request.URL)
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return

View file

@ -59,7 +59,7 @@ func (m *Module) StatusGETHandler(c *gin.Context) {
return
}
resp, errWithCode := m.processor.GetFediStatus(apiutil.TransferSignatureContext(c), requestedUsername, requestedStatusID, c.Request.URL)
resp, errWithCode := m.processor.Fedi().StatusGet(apiutil.TransferSignatureContext(c), requestedUsername, requestedStatusID, c.Request.URL)
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return

View file

@ -57,10 +57,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,
}

View file

@ -44,7 +44,7 @@ type UserStandardTestSuite struct {
mediaManager media.Manager
federator federation.Federator
emailSender email.Sender
processor processing.Processor
processor *processing.Processor
storage *storage.Driver
// standard suite models

View file

@ -59,7 +59,7 @@ func (m *Module) UsersGETHandler(c *gin.Context) {
return
}
resp, errWithCode := m.processor.GetFediUser(apiutil.TransferSignatureContext(c), requestedUsername, c.Request.URL)
resp, errWithCode := m.processor.Fedi().UserGet(apiutil.TransferSignatureContext(c), requestedUsername, c.Request.URL)
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return

View file

@ -32,7 +32,6 @@ import (
"github.com/superseriousbusiness/activity/streams/vocab"
"github.com/superseriousbusiness/gotosocial/internal/api/activitypub/users"
apimodel "github.com/superseriousbusiness/gotosocial/internal/api/model"
"github.com/superseriousbusiness/gotosocial/internal/oauth"
"github.com/superseriousbusiness/gotosocial/testrig"
)
@ -100,13 +99,7 @@ func (suite *UserGetTestSuite) TestGetUserPublicKeyDeleted() {
userModule := users.New(suite.processor)
targetAccount := suite.testAccounts["local_account_1"]
// first delete the account, as though zork had deleted himself
authed := &oauth.Auth{
Application: suite.testApplications["local_account_1"],
User: suite.testUsers["local_account_1"],
Account: suite.testAccounts["local_account_1"],
}
suite.processor.AccountDeleteLocal(context.Background(), authed, &apimodel.AccountDeleteRequest{
suite.processor.Account().DeleteLocal(context.Background(), suite.testAccounts["local_account_1"], &apimodel.AccountDeleteRequest{
Password: "password",
DeleteOriginID: targetAccount.ID,
})

View file

@ -56,7 +56,7 @@ func (a *Auth) Route(r router.Router, m ...gin.HandlerFunc) {
a.auth.RouteOauth(oauthGroup.Handle)
}
func NewAuth(db db.DB, p processing.Processor, idp oidc.IDP, routerSession *gtsmodel.RouterSession, sessionName string) *Auth {
func NewAuth(db db.DB, p *processing.Processor, idp oidc.IDP, routerSession *gtsmodel.RouterSession, sessionName string) *Auth {
return &Auth{
routerSession: routerSession,
sessionName: sessionName,

View file

@ -78,14 +78,14 @@ const (
type Module struct {
db db.DB
processor processing.Processor
processor *processing.Processor
idp oidc.IDP
}
// New returns an Auth module which provides both 'oauth' and 'auth' endpoints.
//
// It is safe to pass a nil idp if oidc is disabled.
func New(db db.DB, processor processing.Processor, idp oidc.IDP) *Module {
func New(db db.DB, processor *processing.Processor, idp oidc.IDP) *Module {
return &Module{
db: db,
processor: processor,

View file

@ -49,7 +49,7 @@ type AuthStandardTestSuite struct {
storage *storage.Driver
mediaManager media.Manager
federator federation.Federator
processor processing.Processor
processor *processing.Processor
emailSender email.Sender
idp oidc.IDP

View file

@ -49,7 +49,7 @@ import (
)
type Client struct {
processor processing.Processor
processor *processing.Processor
db db.DB
accounts *accounts.Module // api/v1/accounts
@ -110,7 +110,7 @@ func (c *Client) Route(r router.Router, m ...gin.HandlerFunc) {
c.user.Route(h)
}
func NewClient(db db.DB, p processing.Processor) *Client {
func NewClient(db db.DB, p *processing.Processor) *Client {
return &Client{
processor: p,
db: db,

View file

@ -48,7 +48,7 @@ type AccountStandardTestSuite struct {
storage *storage.Driver
mediaManager media.Manager
federator federation.Federator
processor processing.Processor
processor *processing.Processor
emailSender email.Sender
sentEmails map[string]string

View file

@ -102,7 +102,7 @@ func (m *Module) AccountCreatePOSTHandler(c *gin.Context) {
}
form.IP = signUpIP
ti, errWithCode := m.processor.AccountCreate(c.Request.Context(), authed, form)
ti, errWithCode := m.processor.Account().Create(c.Request.Context(), authed.Token, authed.Application, form)
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return

View file

@ -86,7 +86,7 @@ func (m *Module) AccountDeletePOSTHandler(c *gin.Context) {
form.DeleteOriginID = authed.Account.ID
if errWithCode := m.processor.AccountDeleteLocal(c.Request.Context(), authed, form); errWithCode != nil {
if errWithCode := m.processor.Account().DeleteLocal(c.Request.Context(), authed.Account, form); errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return
}

View file

@ -85,7 +85,7 @@ func (m *Module) AccountGETHandler(c *gin.Context) {
return
}
acctInfo, errWithCode := m.processor.AccountGet(c.Request.Context(), authed, targetAcctID)
acctInfo, errWithCode := m.processor.Account().Get(c.Request.Context(), authed.Account, targetAcctID)
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return

View file

@ -74,10 +74,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,
}

View file

@ -153,7 +153,7 @@ func (m *Module) AccountUpdateCredentialsPATCHHandler(c *gin.Context) {
return
}
acctSensitive, errWithCode := m.processor.AccountUpdate(c.Request.Context(), authed, form)
acctSensitive, errWithCode := m.processor.Account().Update(c.Request.Context(), authed.Account, form)
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return

View file

@ -68,7 +68,7 @@ func (m *Module) AccountVerifyGETHandler(c *gin.Context) {
return
}
acctSensitive, errWithCode := m.processor.AccountGet(c.Request.Context(), authed, authed.Account.ID)
acctSensitive, errWithCode := m.processor.Account().Get(c.Request.Context(), authed.Account, authed.Account.ID)
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return

View file

@ -85,7 +85,7 @@ func (m *Module) AccountBlockPOSTHandler(c *gin.Context) {
return
}
relationship, errWithCode := m.processor.AccountBlockCreate(c.Request.Context(), authed, targetAcctID)
relationship, errWithCode := m.processor.Account().BlockCreate(c.Request.Context(), authed.Account, targetAcctID)
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return

View file

@ -114,7 +114,7 @@ func (m *Module) AccountFollowPOSTHandler(c *gin.Context) {
}
form.ID = targetAcctID
relationship, errWithCode := m.processor.AccountFollowCreate(c.Request.Context(), authed, form)
relationship, errWithCode := m.processor.Account().FollowCreate(c.Request.Context(), authed.Account, form)
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return

View file

@ -88,7 +88,7 @@ func (m *Module) AccountFollowersGETHandler(c *gin.Context) {
return
}
followers, errWithCode := m.processor.AccountFollowersGet(c.Request.Context(), authed, targetAcctID)
followers, errWithCode := m.processor.Account().FollowersGet(c.Request.Context(), authed.Account, targetAcctID)
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return

View file

@ -88,7 +88,7 @@ func (m *Module) AccountFollowingGETHandler(c *gin.Context) {
return
}
following, errWithCode := m.processor.AccountFollowingGet(c.Request.Context(), authed, targetAcctID)
following, errWithCode := m.processor.Account().FollowingGet(c.Request.Context(), authed.Account, targetAcctID)
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return

View file

@ -81,7 +81,7 @@ func (m *Module) AccountRelationshipsGETHandler(c *gin.Context) {
relationships := []apimodel.Relationship{}
for _, targetAccountID := range targetAccountIDs {
r, errWithCode := m.processor.AccountRelationshipGet(c.Request.Context(), authed, targetAccountID)
r, errWithCode := m.processor.Account().RelationshipGet(c.Request.Context(), authed.Account, targetAccountID)
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return

View file

@ -233,7 +233,7 @@ func (m *Module) AccountStatusesGETHandler(c *gin.Context) {
publicOnly = i
}
resp, errWithCode := m.processor.AccountStatusesGet(c.Request.Context(), authed, targetAcctID, limit, excludeReplies, excludeReblogs, maxID, minID, pinnedOnly, mediaOnly, publicOnly)
resp, errWithCode := m.processor.Account().StatusesGet(c.Request.Context(), authed.Account, targetAcctID, limit, excludeReplies, excludeReblogs, maxID, minID, pinnedOnly, mediaOnly, publicOnly)
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return

View file

@ -86,7 +86,7 @@ func (m *Module) AccountUnblockPOSTHandler(c *gin.Context) {
return
}
relationship, errWithCode := m.processor.AccountBlockRemove(c.Request.Context(), authed, targetAcctID)
relationship, errWithCode := m.processor.Account().BlockRemove(c.Request.Context(), authed.Account, targetAcctID)
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return

View file

@ -86,7 +86,7 @@ func (m *Module) AccountUnfollowPOSTHandler(c *gin.Context) {
return
}
relationship, errWithCode := m.processor.AccountFollowRemove(c.Request.Context(), authed, targetAcctID)
relationship, errWithCode := m.processor.Account().FollowRemove(c.Request.Context(), authed.Account, targetAcctID)
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return

View file

@ -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
}

View file

@ -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,
}

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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
}

View file

@ -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
}

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -29,10 +29,10 @@ import (
const BasePath = "/v1/apps"
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,
}

View file

@ -38,10 +38,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,
}

View file

@ -31,10 +31,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,
}

View file

@ -53,7 +53,7 @@ type BookmarkTestSuite struct {
mediaManager media.Manager
federator federation.Federator
emailSender email.Sender
processor processing.Processor
processor *processing.Processor
storage *storage.Driver
// standard suite models

View file

@ -89,7 +89,7 @@ func (m *Module) BookmarksGETHandler(c *gin.Context) {
minID = minIDString
}
resp, errWithCode := m.processor.BookmarksGet(c.Request.Context(), authed, maxID, minID, limit)
resp, errWithCode := m.processor.Account().BookmarksGet(c.Request.Context(), authed.Account, limit, maxID, minID)
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return

View file

@ -31,10 +31,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,
}

View file

@ -66,7 +66,7 @@ func (m *Module) CustomEmojisGETHandler(c *gin.Context) {
return
}
emojis, errWithCode := m.processor.CustomEmojisGet(c)
emojis, errWithCode := m.processor.Media().GetCustomEmojis(c)
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return

View file

@ -42,10 +42,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,
}

View file

@ -42,7 +42,7 @@ type FavouritesStandardTestSuite struct {
mediaManager media.Manager
federator federation.Federator
emailSender email.Sender
processor processing.Processor
processor *processing.Processor
storage *storage.Driver
// standard suite models

View file

@ -30,10 +30,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,
}

View file

@ -31,10 +31,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,
}

View file

@ -40,10 +40,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,
}

View file

@ -46,7 +46,7 @@ type FollowRequestStandardTestSuite struct {
storage *storage.Driver
mediaManager media.Manager
federator federation.Federator
processor processing.Processor
processor *processing.Processor
emailSender email.Sender
// standard suite models

View file

@ -33,10 +33,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,
}

View file

@ -47,7 +47,7 @@ type InstanceStandardTestSuite struct {
storage *storage.Driver
mediaManager media.Manager
federator federation.Federator
processor processing.Processor
processor *processing.Processor
emailSender email.Sender
sentEmails map[string]string

View file

@ -31,10 +31,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,
}

View file

@ -35,10 +35,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,
}

View file

@ -123,7 +123,7 @@ func (m *Module) MediaCreatePOSTHandler(c *gin.Context) {
return
}
apiAttachment, errWithCode := m.processor.MediaCreate(c.Request.Context(), authed, form)
apiAttachment, errWithCode := m.processor.Media().Create(c.Request.Context(), authed.Account, form)
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return

View file

@ -59,7 +59,7 @@ type MediaCreateTestSuite struct {
tc typeutils.TypeConverter
oauthServer oauth.Server
emailSender email.Sender
processor processing.Processor
processor *processing.Processor
// standard suite models
testTokens map[string]*gtsmodel.Token

View file

@ -91,7 +91,7 @@ func (m *Module) MediaGETHandler(c *gin.Context) {
return
}
attachment, errWithCode := m.processor.MediaGet(c.Request.Context(), authed, attachmentID)
attachment, errWithCode := m.processor.Media().Get(c.Request.Context(), authed.Account, attachmentID)
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return

View file

@ -134,7 +134,7 @@ func (m *Module) MediaPUTHandler(c *gin.Context) {
return
}
attachment, errWithCode := m.processor.MediaUpdate(c.Request.Context(), authed, attachmentID, form)
attachment, errWithCode := m.processor.Media().Update(c.Request.Context(), authed.Account, attachmentID, form)
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return

View file

@ -57,7 +57,7 @@ type MediaUpdateTestSuite struct {
mediaManager media.Manager
oauthServer oauth.Server
emailSender email.Sender
processor processing.Processor
processor *processing.Processor
// standard suite models
testTokens map[string]*gtsmodel.Token

View file

@ -46,10 +46,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,
}

View file

@ -102,7 +102,7 @@ func (m *Module) ReportPOSTHandler(c *gin.Context) {
return
}
apiReport, errWithCode := m.processor.ReportCreate(c.Request.Context(), authed, form)
apiReport, errWithCode := m.processor.Report().Create(c.Request.Context(), authed.Account, form)
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return

View file

@ -85,7 +85,7 @@ func (m *Module) ReportGETHandler(c *gin.Context) {
return
}
report, errWithCode := m.processor.ReportGet(c.Request.Context(), authed, targetReportID)
report, errWithCode := m.processor.Report().Get(c.Request.Context(), authed.Account, targetReportID)
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return

View file

@ -38,10 +38,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,
}

View file

@ -39,7 +39,7 @@ type ReportsStandardTestSuite struct {
storage *storage.Driver
mediaManager media.Manager
federator federation.Federator
processor processing.Processor
processor *processing.Processor
emailSender email.Sender
sentEmails map[string]string

View file

@ -160,7 +160,7 @@ func (m *Module) ReportsGETHandler(c *gin.Context) {
limit = i
}
resp, errWithCode := m.processor.ReportsGet(c.Request.Context(), authed, resolved, c.Query(TargetAccountIDKey), c.Query(MaxIDKey), c.Query(SinceIDKey), c.Query(MinIDKey), limit)
resp, errWithCode := m.processor.Report().GetMultiple(c.Request.Context(), authed.Account, resolved, c.Query(TargetAccountIDKey), c.Query(MaxIDKey), c.Query(SinceIDKey), c.Query(MinIDKey), limit)
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return

View file

@ -62,10 +62,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,
}

View file

@ -47,7 +47,7 @@ type SearchStandardTestSuite struct {
storage *storage.Driver
mediaManager media.Manager
federator federation.Federator
processor processing.Processor
processor *processing.Processor
emailSender email.Sender
sentEmails map[string]string

View file

@ -68,10 +68,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,
}

View file

@ -42,7 +42,7 @@ type StatusStandardTestSuite struct {
mediaManager media.Manager
federator federation.Federator
emailSender email.Sender
processor processing.Processor
processor *processing.Processor
storage *storage.Driver
// standard suite models

View file

@ -88,7 +88,7 @@ func (m *Module) StatusBookmarkPOSTHandler(c *gin.Context) {
return
}
apiStatus, errWithCode := m.processor.StatusBookmark(c.Request.Context(), authed, targetStatusID)
apiStatus, errWithCode := m.processor.Status().BookmarkCreate(c.Request.Context(), authed.Account, targetStatusID)
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return

View file

@ -91,7 +91,7 @@ func (m *Module) StatusBoostPOSTHandler(c *gin.Context) {
return
}
apiStatus, errWithCode := m.processor.StatusBoost(c.Request.Context(), authed, targetStatusID)
apiStatus, errWithCode := m.processor.Status().BoostCreate(c.Request.Context(), authed.Account, authed.Application, targetStatusID)
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return

View file

@ -79,7 +79,7 @@ func (m *Module) StatusBoostedByGETHandler(c *gin.Context) {
return
}
apiAccounts, errWithCode := m.processor.StatusBoostedBy(c.Request.Context(), authed, targetStatusID)
apiAccounts, errWithCode := m.processor.Status().StatusBoostedBy(c.Request.Context(), authed.Account, targetStatusID)
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return

View file

@ -90,7 +90,7 @@ func (m *Module) StatusContextGETHandler(c *gin.Context) {
return
}
statusContext, errWithCode := m.processor.StatusGetContext(c.Request.Context(), authed, targetStatusID)
statusContext, errWithCode := m.processor.Status().ContextGet(c.Request.Context(), authed.Account, targetStatusID)
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return

View file

@ -104,7 +104,7 @@ func (m *Module) StatusCreatePOSTHandler(c *gin.Context) {
return
}
apiStatus, errWithCode := m.processor.StatusCreate(c.Request.Context(), authed, form)
apiStatus, errWithCode := m.processor.Status().Create(c.Request.Context(), authed.Account, authed.Application, form)
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return

View file

@ -90,7 +90,7 @@ func (m *Module) StatusDELETEHandler(c *gin.Context) {
return
}
apiStatus, errWithCode := m.processor.StatusDelete(c.Request.Context(), authed, targetStatusID)
apiStatus, errWithCode := m.processor.Status().Delete(c.Request.Context(), authed.Account, targetStatusID)
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return

View file

@ -87,7 +87,7 @@ func (m *Module) StatusFavePOSTHandler(c *gin.Context) {
return
}
apiStatus, errWithCode := m.processor.StatusFave(c.Request.Context(), authed, targetStatusID)
apiStatus, errWithCode := m.processor.Status().FaveCreate(c.Request.Context(), authed.Account, targetStatusID)
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return

View file

@ -88,7 +88,7 @@ func (m *Module) StatusFavedByGETHandler(c *gin.Context) {
return
}
apiAccounts, errWithCode := m.processor.StatusFavedBy(c.Request.Context(), authed, targetStatusID)
apiAccounts, errWithCode := m.processor.Status().FavedBy(c.Request.Context(), authed.Account, targetStatusID)
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return

View file

@ -87,7 +87,7 @@ func (m *Module) StatusGETHandler(c *gin.Context) {
return
}
apiStatus, errWithCode := m.processor.StatusGet(c.Request.Context(), authed, targetStatusID)
apiStatus, errWithCode := m.processor.Status().Get(c.Request.Context(), authed.Account, targetStatusID)
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return

View file

@ -88,7 +88,7 @@ func (m *Module) StatusUnbookmarkPOSTHandler(c *gin.Context) {
return
}
apiStatus, errWithCode := m.processor.StatusUnbookmark(c.Request.Context(), authed, targetStatusID)
apiStatus, errWithCode := m.processor.Status().BookmarkRemove(c.Request.Context(), authed.Account, targetStatusID)
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return

View file

@ -88,7 +88,7 @@ func (m *Module) StatusUnboostPOSTHandler(c *gin.Context) {
return
}
apiStatus, errWithCode := m.processor.StatusUnboost(c.Request.Context(), authed, targetStatusID)
apiStatus, errWithCode := m.processor.Status().BoostRemove(c.Request.Context(), authed.Account, authed.Application, targetStatusID)
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return

View file

@ -87,7 +87,7 @@ func (m *Module) StatusUnfavePOSTHandler(c *gin.Context) {
return
}
apiStatus, errWithCode := m.processor.StatusUnfave(c.Request.Context(), authed, targetStatusID)
apiStatus, errWithCode := m.processor.Status().FaveRemove(c.Request.Context(), authed.Account, targetStatusID)
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return

View file

@ -154,13 +154,13 @@ func (m *Module) StreamGETHandler(c *gin.Context) {
}
}
account, errWithCode := m.processor.AuthorizeStreamingRequest(c.Request.Context(), token)
account, errWithCode := m.processor.Stream().Authorize(c.Request.Context(), token)
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return
}
stream, errWithCode := m.processor.OpenStreamForAccount(c.Request.Context(), account, streamType)
stream, errWithCode := m.processor.Stream().Open(c.Request.Context(), account, streamType)
if errWithCode != nil {
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
return

View file

@ -42,12 +42,12 @@ const (
)
type Module struct {
processor processing.Processor
processor *processing.Processor
dTicker time.Duration
wsUpgrade websocket.Upgrader
}
func New(processor processing.Processor, dTicker time.Duration, wsBuf int) *Module {
func New(processor *processing.Processor, dTicker time.Duration, wsBuf int) *Module {
return &Module{
processor: processor,
dTicker: dTicker,

View file

@ -54,7 +54,7 @@ type StreamingTestSuite struct {
mediaManager media.Manager
federator federation.Federator
emailSender email.Sender
processor processing.Processor
processor *processing.Processor
storage *storage.Driver
// standard suite models

Some files were not shown because too many files have changed in this diff Show more