mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-11-22 11:46:40 +00: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:
parent
adb596600b
commit
b6fbdc66c1
|
@ -59,7 +59,7 @@ func (a *ActivityPub) RoutePublicKey(r router.Router, m ...gin.HandlerFunc) {
|
||||||
a.publicKey.Route(publicKeyGroup.Handle)
|
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{
|
return &ActivityPub{
|
||||||
emoji: emoji.New(p),
|
emoji: emoji.New(p),
|
||||||
users: users.New(p),
|
users: users.New(p),
|
||||||
|
|
|
@ -33,10 +33,10 @@
|
||||||
)
|
)
|
||||||
|
|
||||||
type Module struct {
|
type Module struct {
|
||||||
processor processing.Processor
|
processor *processing.Processor
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(processor processing.Processor) *Module {
|
func New(processor *processing.Processor) *Module {
|
||||||
return &Module{
|
return &Module{
|
||||||
processor: processor,
|
processor: processor,
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ func (m *Module) EmojiGetHandler(c *gin.Context) {
|
||||||
return
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -48,7 +48,7 @@ type EmojiGetTestSuite struct {
|
||||||
mediaManager media.Manager
|
mediaManager media.Manager
|
||||||
federator federation.Federator
|
federator federation.Federator
|
||||||
emailSender email.Sender
|
emailSender email.Sender
|
||||||
processor processing.Processor
|
processor *processing.Processor
|
||||||
storage *storage.Driver
|
storage *storage.Driver
|
||||||
|
|
||||||
testEmojis map[string]*gtsmodel.Emoji
|
testEmojis map[string]*gtsmodel.Emoji
|
||||||
|
|
|
@ -34,10 +34,10 @@
|
||||||
)
|
)
|
||||||
|
|
||||||
type Module struct {
|
type Module struct {
|
||||||
processor processing.Processor
|
processor *processing.Processor
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(processor processing.Processor) *Module {
|
func New(processor *processing.Processor) *Module {
|
||||||
return &Module{
|
return &Module{
|
||||||
processor: processor,
|
processor: processor,
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ func (m *Module) PublicKeyGETHandler(c *gin.Context) {
|
||||||
return
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -51,7 +51,7 @@ func (m *Module) FollowersGETHandler(c *gin.Context) {
|
||||||
return
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -51,7 +51,7 @@ func (m *Module) FollowingGETHandler(c *gin.Context) {
|
||||||
return
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -38,7 +38,7 @@ func (m *Module) InboxPOSTHandler(c *gin.Context) {
|
||||||
return
|
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 {
|
if withCode, ok := err.(gtserror.WithCode); ok {
|
||||||
apiutil.ErrorHandler(c, withCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, withCode, m.processor.InstanceGetV1)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -129,7 +129,7 @@ func (m *Module) OutboxGETHandler(c *gin.Context) {
|
||||||
maxID = maxIDString
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -150,7 +150,7 @@ func (m *Module) StatusRepliesGETHandler(c *gin.Context) {
|
||||||
minID = minIDString
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -59,7 +59,7 @@ func (m *Module) StatusGETHandler(c *gin.Context) {
|
||||||
return
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -57,10 +57,10 @@
|
||||||
)
|
)
|
||||||
|
|
||||||
type Module struct {
|
type Module struct {
|
||||||
processor processing.Processor
|
processor *processing.Processor
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(processor processing.Processor) *Module {
|
func New(processor *processing.Processor) *Module {
|
||||||
return &Module{
|
return &Module{
|
||||||
processor: processor,
|
processor: processor,
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ type UserStandardTestSuite struct {
|
||||||
mediaManager media.Manager
|
mediaManager media.Manager
|
||||||
federator federation.Federator
|
federator federation.Federator
|
||||||
emailSender email.Sender
|
emailSender email.Sender
|
||||||
processor processing.Processor
|
processor *processing.Processor
|
||||||
storage *storage.Driver
|
storage *storage.Driver
|
||||||
|
|
||||||
// standard suite models
|
// standard suite models
|
||||||
|
|
|
@ -59,7 +59,7 @@ func (m *Module) UsersGETHandler(c *gin.Context) {
|
||||||
return
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
"github.com/superseriousbusiness/activity/streams/vocab"
|
"github.com/superseriousbusiness/activity/streams/vocab"
|
||||||
"github.com/superseriousbusiness/gotosocial/internal/api/activitypub/users"
|
"github.com/superseriousbusiness/gotosocial/internal/api/activitypub/users"
|
||||||
apimodel "github.com/superseriousbusiness/gotosocial/internal/api/model"
|
apimodel "github.com/superseriousbusiness/gotosocial/internal/api/model"
|
||||||
"github.com/superseriousbusiness/gotosocial/internal/oauth"
|
|
||||||
"github.com/superseriousbusiness/gotosocial/testrig"
|
"github.com/superseriousbusiness/gotosocial/testrig"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -100,13 +99,7 @@ func (suite *UserGetTestSuite) TestGetUserPublicKeyDeleted() {
|
||||||
userModule := users.New(suite.processor)
|
userModule := users.New(suite.processor)
|
||||||
targetAccount := suite.testAccounts["local_account_1"]
|
targetAccount := suite.testAccounts["local_account_1"]
|
||||||
|
|
||||||
// first delete the account, as though zork had deleted himself
|
suite.processor.Account().DeleteLocal(context.Background(), suite.testAccounts["local_account_1"], &apimodel.AccountDeleteRequest{
|
||||||
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{
|
|
||||||
Password: "password",
|
Password: "password",
|
||||||
DeleteOriginID: targetAccount.ID,
|
DeleteOriginID: targetAccount.ID,
|
||||||
})
|
})
|
||||||
|
|
|
@ -56,7 +56,7 @@ func (a *Auth) Route(r router.Router, m ...gin.HandlerFunc) {
|
||||||
a.auth.RouteOauth(oauthGroup.Handle)
|
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{
|
return &Auth{
|
||||||
routerSession: routerSession,
|
routerSession: routerSession,
|
||||||
sessionName: sessionName,
|
sessionName: sessionName,
|
||||||
|
|
|
@ -78,14 +78,14 @@
|
||||||
|
|
||||||
type Module struct {
|
type Module struct {
|
||||||
db db.DB
|
db db.DB
|
||||||
processor processing.Processor
|
processor *processing.Processor
|
||||||
idp oidc.IDP
|
idp oidc.IDP
|
||||||
}
|
}
|
||||||
|
|
||||||
// New returns an Auth module which provides both 'oauth' and 'auth' endpoints.
|
// New returns an Auth module which provides both 'oauth' and 'auth' endpoints.
|
||||||
//
|
//
|
||||||
// It is safe to pass a nil idp if oidc is disabled.
|
// 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{
|
return &Module{
|
||||||
db: db,
|
db: db,
|
||||||
processor: processor,
|
processor: processor,
|
||||||
|
|
|
@ -49,7 +49,7 @@ type AuthStandardTestSuite struct {
|
||||||
storage *storage.Driver
|
storage *storage.Driver
|
||||||
mediaManager media.Manager
|
mediaManager media.Manager
|
||||||
federator federation.Federator
|
federator federation.Federator
|
||||||
processor processing.Processor
|
processor *processing.Processor
|
||||||
emailSender email.Sender
|
emailSender email.Sender
|
||||||
idp oidc.IDP
|
idp oidc.IDP
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
)
|
)
|
||||||
|
|
||||||
type Client struct {
|
type Client struct {
|
||||||
processor processing.Processor
|
processor *processing.Processor
|
||||||
db db.DB
|
db db.DB
|
||||||
|
|
||||||
accounts *accounts.Module // api/v1/accounts
|
accounts *accounts.Module // api/v1/accounts
|
||||||
|
@ -110,7 +110,7 @@ func (c *Client) Route(r router.Router, m ...gin.HandlerFunc) {
|
||||||
c.user.Route(h)
|
c.user.Route(h)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewClient(db db.DB, p processing.Processor) *Client {
|
func NewClient(db db.DB, p *processing.Processor) *Client {
|
||||||
return &Client{
|
return &Client{
|
||||||
processor: p,
|
processor: p,
|
||||||
db: db,
|
db: db,
|
||||||
|
|
|
@ -48,7 +48,7 @@ type AccountStandardTestSuite struct {
|
||||||
storage *storage.Driver
|
storage *storage.Driver
|
||||||
mediaManager media.Manager
|
mediaManager media.Manager
|
||||||
federator federation.Federator
|
federator federation.Federator
|
||||||
processor processing.Processor
|
processor *processing.Processor
|
||||||
emailSender email.Sender
|
emailSender email.Sender
|
||||||
sentEmails map[string]string
|
sentEmails map[string]string
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,7 @@ func (m *Module) AccountCreatePOSTHandler(c *gin.Context) {
|
||||||
}
|
}
|
||||||
form.IP = signUpIP
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -86,7 +86,7 @@ func (m *Module) AccountDeletePOSTHandler(c *gin.Context) {
|
||||||
|
|
||||||
form.DeleteOriginID = authed.Account.ID
|
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)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,7 @@ func (m *Module) AccountGETHandler(c *gin.Context) {
|
||||||
return
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -74,10 +74,10 @@
|
||||||
)
|
)
|
||||||
|
|
||||||
type Module struct {
|
type Module struct {
|
||||||
processor processing.Processor
|
processor *processing.Processor
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(processor processing.Processor) *Module {
|
func New(processor *processing.Processor) *Module {
|
||||||
return &Module{
|
return &Module{
|
||||||
processor: processor,
|
processor: processor,
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,7 +153,7 @@ func (m *Module) AccountUpdateCredentialsPATCHHandler(c *gin.Context) {
|
||||||
return
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -68,7 +68,7 @@ func (m *Module) AccountVerifyGETHandler(c *gin.Context) {
|
||||||
return
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -85,7 +85,7 @@ func (m *Module) AccountBlockPOSTHandler(c *gin.Context) {
|
||||||
return
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -114,7 +114,7 @@ func (m *Module) AccountFollowPOSTHandler(c *gin.Context) {
|
||||||
}
|
}
|
||||||
form.ID = targetAcctID
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -88,7 +88,7 @@ func (m *Module) AccountFollowersGETHandler(c *gin.Context) {
|
||||||
return
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -88,7 +88,7 @@ func (m *Module) AccountFollowingGETHandler(c *gin.Context) {
|
||||||
return
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -81,7 +81,7 @@ func (m *Module) AccountRelationshipsGETHandler(c *gin.Context) {
|
||||||
relationships := []apimodel.Relationship{}
|
relationships := []apimodel.Relationship{}
|
||||||
|
|
||||||
for _, targetAccountID := range targetAccountIDs {
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -233,7 +233,7 @@ func (m *Module) AccountStatusesGETHandler(c *gin.Context) {
|
||||||
publicOnly = i
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -86,7 +86,7 @@ func (m *Module) AccountUnblockPOSTHandler(c *gin.Context) {
|
||||||
return
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -86,7 +86,7 @@ func (m *Module) AccountUnfollowPOSTHandler(c *gin.Context) {
|
||||||
return
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -115,7 +115,7 @@ func (m *Module) AccountActionPOSTHandler(c *gin.Context) {
|
||||||
}
|
}
|
||||||
form.TargetAccountID = targetAcctID
|
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)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,10 +83,10 @@
|
||||||
)
|
)
|
||||||
|
|
||||||
type Module struct {
|
type Module struct {
|
||||||
processor processing.Processor
|
processor *processing.Processor
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(processor processing.Processor) *Module {
|
func New(processor *processing.Processor) *Module {
|
||||||
return &Module{
|
return &Module{
|
||||||
processor: processor,
|
processor: processor,
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ type AdminStandardTestSuite struct {
|
||||||
storage *storage.Driver
|
storage *storage.Driver
|
||||||
mediaManager media.Manager
|
mediaManager media.Manager
|
||||||
federator federation.Federator
|
federator federation.Federator
|
||||||
processor processing.Processor
|
processor *processing.Processor
|
||||||
emailSender email.Sender
|
emailSender email.Sender
|
||||||
sentEmails map[string]string
|
sentEmails map[string]string
|
||||||
|
|
||||||
|
|
|
@ -167,7 +167,7 @@ func (m *Module) DomainBlocksPOSTHandler(c *gin.Context) {
|
||||||
|
|
||||||
if imp {
|
if imp {
|
||||||
// we're importing multiple blocks
|
// 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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
@ -177,7 +177,7 @@ func (m *Module) DomainBlocksPOSTHandler(c *gin.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// we're just creating one block
|
// 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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -94,7 +94,7 @@ func (m *Module) DomainBlockDELETEHandler(c *gin.Context) {
|
||||||
return
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -107,7 +107,7 @@ func (m *Module) DomainBlockGETHandler(c *gin.Context) {
|
||||||
export = i
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -105,7 +105,7 @@ func (m *Module) DomainBlocksGETHandler(c *gin.Context) {
|
||||||
export = i
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -84,7 +84,7 @@ func (m *Module) EmojiCategoriesGETHandler(c *gin.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
categories, errWithCode := m.processor.AdminEmojiCategoriesGet(c.Request.Context())
|
categories, errWithCode := m.processor.Admin().EmojiCategoriesGet(c.Request.Context())
|
||||||
if errWithCode != nil {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -126,7 +126,7 @@ func (m *Module) EmojiCreatePOSTHandler(c *gin.Context) {
|
||||||
return
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -100,7 +100,7 @@ func (m *Module) EmojiDELETEHandler(c *gin.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
emoji, errWithCode := m.processor.AdminEmojiDelete(c.Request.Context(), authed, emojiID)
|
emoji, errWithCode := m.processor.Admin().EmojiDelete(c.Request.Context(), emojiID)
|
||||||
if errWithCode != nil {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -90,7 +90,7 @@ func (m *Module) EmojiGETHandler(c *gin.Context) {
|
||||||
return
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -198,7 +198,7 @@ func (m *Module) EmojisGETHandler(c *gin.Context) {
|
||||||
includeEnabled = true
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -156,7 +156,7 @@ func (m *Module) EmojiPATCHHandler(c *gin.Context) {
|
||||||
return
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -98,7 +98,7 @@ func (m *Module) MediaCleanupPOSTHandler(c *gin.Context) {
|
||||||
remoteCacheDays = 0
|
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)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,7 @@ func (m *Module) MediaRefetchPOSTHandler(c *gin.Context) {
|
||||||
return
|
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)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,7 +93,7 @@ func (m *Module) ReportGETHandler(c *gin.Context) {
|
||||||
return
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -115,7 +115,7 @@ func (m *Module) ReportResolvePOSTHandler(c *gin.Context) {
|
||||||
return
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -171,7 +171,7 @@ func (m *Module) ReportsGETHandler(c *gin.Context) {
|
||||||
limit = i
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -29,10 +29,10 @@
|
||||||
const BasePath = "/v1/apps"
|
const BasePath = "/v1/apps"
|
||||||
|
|
||||||
type Module struct {
|
type Module struct {
|
||||||
processor processing.Processor
|
processor *processing.Processor
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(processor processing.Processor) *Module {
|
func New(processor *processing.Processor) *Module {
|
||||||
return &Module{
|
return &Module{
|
||||||
processor: processor,
|
processor: processor,
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,10 +38,10 @@
|
||||||
)
|
)
|
||||||
|
|
||||||
type Module struct {
|
type Module struct {
|
||||||
processor processing.Processor
|
processor *processing.Processor
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(processor processing.Processor) *Module {
|
func New(processor *processing.Processor) *Module {
|
||||||
return &Module{
|
return &Module{
|
||||||
processor: processor,
|
processor: processor,
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,10 +31,10 @@
|
||||||
)
|
)
|
||||||
|
|
||||||
type Module struct {
|
type Module struct {
|
||||||
processor processing.Processor
|
processor *processing.Processor
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(processor processing.Processor) *Module {
|
func New(processor *processing.Processor) *Module {
|
||||||
return &Module{
|
return &Module{
|
||||||
processor: processor,
|
processor: processor,
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ type BookmarkTestSuite struct {
|
||||||
mediaManager media.Manager
|
mediaManager media.Manager
|
||||||
federator federation.Federator
|
federator federation.Federator
|
||||||
emailSender email.Sender
|
emailSender email.Sender
|
||||||
processor processing.Processor
|
processor *processing.Processor
|
||||||
storage *storage.Driver
|
storage *storage.Driver
|
||||||
|
|
||||||
// standard suite models
|
// standard suite models
|
||||||
|
|
|
@ -89,7 +89,7 @@ func (m *Module) BookmarksGETHandler(c *gin.Context) {
|
||||||
minID = minIDString
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -31,10 +31,10 @@
|
||||||
)
|
)
|
||||||
|
|
||||||
type Module struct {
|
type Module struct {
|
||||||
processor processing.Processor
|
processor *processing.Processor
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(processor processing.Processor) *Module {
|
func New(processor *processing.Processor) *Module {
|
||||||
return &Module{
|
return &Module{
|
||||||
processor: processor,
|
processor: processor,
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ func (m *Module) CustomEmojisGETHandler(c *gin.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
emojis, errWithCode := m.processor.CustomEmojisGet(c)
|
emojis, errWithCode := m.processor.Media().GetCustomEmojis(c)
|
||||||
if errWithCode != nil {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -42,10 +42,10 @@
|
||||||
)
|
)
|
||||||
|
|
||||||
type Module struct {
|
type Module struct {
|
||||||
processor processing.Processor
|
processor *processing.Processor
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(processor processing.Processor) *Module {
|
func New(processor *processing.Processor) *Module {
|
||||||
return &Module{
|
return &Module{
|
||||||
processor: processor,
|
processor: processor,
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ type FavouritesStandardTestSuite struct {
|
||||||
mediaManager media.Manager
|
mediaManager media.Manager
|
||||||
federator federation.Federator
|
federator federation.Federator
|
||||||
emailSender email.Sender
|
emailSender email.Sender
|
||||||
processor processing.Processor
|
processor *processing.Processor
|
||||||
storage *storage.Driver
|
storage *storage.Driver
|
||||||
|
|
||||||
// standard suite models
|
// standard suite models
|
||||||
|
|
|
@ -30,10 +30,10 @@
|
||||||
)
|
)
|
||||||
|
|
||||||
type Module struct {
|
type Module struct {
|
||||||
processor processing.Processor
|
processor *processing.Processor
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(processor processing.Processor) *Module {
|
func New(processor *processing.Processor) *Module {
|
||||||
return &Module{
|
return &Module{
|
||||||
processor: processor,
|
processor: processor,
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,10 +31,10 @@
|
||||||
)
|
)
|
||||||
|
|
||||||
type Module struct {
|
type Module struct {
|
||||||
processor processing.Processor
|
processor *processing.Processor
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(processor processing.Processor) *Module {
|
func New(processor *processing.Processor) *Module {
|
||||||
return &Module{
|
return &Module{
|
||||||
processor: processor,
|
processor: processor,
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,10 +40,10 @@
|
||||||
)
|
)
|
||||||
|
|
||||||
type Module struct {
|
type Module struct {
|
||||||
processor processing.Processor
|
processor *processing.Processor
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(processor processing.Processor) *Module {
|
func New(processor *processing.Processor) *Module {
|
||||||
return &Module{
|
return &Module{
|
||||||
processor: processor,
|
processor: processor,
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ type FollowRequestStandardTestSuite struct {
|
||||||
storage *storage.Driver
|
storage *storage.Driver
|
||||||
mediaManager media.Manager
|
mediaManager media.Manager
|
||||||
federator federation.Federator
|
federator federation.Federator
|
||||||
processor processing.Processor
|
processor *processing.Processor
|
||||||
emailSender email.Sender
|
emailSender email.Sender
|
||||||
|
|
||||||
// standard suite models
|
// standard suite models
|
||||||
|
|
|
@ -33,10 +33,10 @@
|
||||||
)
|
)
|
||||||
|
|
||||||
type Module struct {
|
type Module struct {
|
||||||
processor processing.Processor
|
processor *processing.Processor
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(processor processing.Processor) *Module {
|
func New(processor *processing.Processor) *Module {
|
||||||
return &Module{
|
return &Module{
|
||||||
processor: processor,
|
processor: processor,
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ type InstanceStandardTestSuite struct {
|
||||||
storage *storage.Driver
|
storage *storage.Driver
|
||||||
mediaManager media.Manager
|
mediaManager media.Manager
|
||||||
federator federation.Federator
|
federator federation.Federator
|
||||||
processor processing.Processor
|
processor *processing.Processor
|
||||||
emailSender email.Sender
|
emailSender email.Sender
|
||||||
sentEmails map[string]string
|
sentEmails map[string]string
|
||||||
|
|
||||||
|
|
|
@ -31,10 +31,10 @@
|
||||||
)
|
)
|
||||||
|
|
||||||
type Module struct {
|
type Module struct {
|
||||||
processor processing.Processor
|
processor *processing.Processor
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(processor processing.Processor) *Module {
|
func New(processor *processing.Processor) *Module {
|
||||||
return &Module{
|
return &Module{
|
||||||
processor: processor,
|
processor: processor,
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,10 +35,10 @@
|
||||||
)
|
)
|
||||||
|
|
||||||
type Module struct {
|
type Module struct {
|
||||||
processor processing.Processor
|
processor *processing.Processor
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(processor processing.Processor) *Module {
|
func New(processor *processing.Processor) *Module {
|
||||||
return &Module{
|
return &Module{
|
||||||
processor: processor,
|
processor: processor,
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,7 +123,7 @@ func (m *Module) MediaCreatePOSTHandler(c *gin.Context) {
|
||||||
return
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -59,7 +59,7 @@ type MediaCreateTestSuite struct {
|
||||||
tc typeutils.TypeConverter
|
tc typeutils.TypeConverter
|
||||||
oauthServer oauth.Server
|
oauthServer oauth.Server
|
||||||
emailSender email.Sender
|
emailSender email.Sender
|
||||||
processor processing.Processor
|
processor *processing.Processor
|
||||||
|
|
||||||
// standard suite models
|
// standard suite models
|
||||||
testTokens map[string]*gtsmodel.Token
|
testTokens map[string]*gtsmodel.Token
|
||||||
|
|
|
@ -91,7 +91,7 @@ func (m *Module) MediaGETHandler(c *gin.Context) {
|
||||||
return
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -134,7 +134,7 @@ func (m *Module) MediaPUTHandler(c *gin.Context) {
|
||||||
return
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -57,7 +57,7 @@ type MediaUpdateTestSuite struct {
|
||||||
mediaManager media.Manager
|
mediaManager media.Manager
|
||||||
oauthServer oauth.Server
|
oauthServer oauth.Server
|
||||||
emailSender email.Sender
|
emailSender email.Sender
|
||||||
processor processing.Processor
|
processor *processing.Processor
|
||||||
|
|
||||||
// standard suite models
|
// standard suite models
|
||||||
testTokens map[string]*gtsmodel.Token
|
testTokens map[string]*gtsmodel.Token
|
||||||
|
|
|
@ -46,10 +46,10 @@
|
||||||
)
|
)
|
||||||
|
|
||||||
type Module struct {
|
type Module struct {
|
||||||
processor processing.Processor
|
processor *processing.Processor
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(processor processing.Processor) *Module {
|
func New(processor *processing.Processor) *Module {
|
||||||
return &Module{
|
return &Module{
|
||||||
processor: processor,
|
processor: processor,
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,7 +102,7 @@ func (m *Module) ReportPOSTHandler(c *gin.Context) {
|
||||||
return
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -85,7 +85,7 @@ func (m *Module) ReportGETHandler(c *gin.Context) {
|
||||||
return
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -38,10 +38,10 @@
|
||||||
)
|
)
|
||||||
|
|
||||||
type Module struct {
|
type Module struct {
|
||||||
processor processing.Processor
|
processor *processing.Processor
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(processor processing.Processor) *Module {
|
func New(processor *processing.Processor) *Module {
|
||||||
return &Module{
|
return &Module{
|
||||||
processor: processor,
|
processor: processor,
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ type ReportsStandardTestSuite struct {
|
||||||
storage *storage.Driver
|
storage *storage.Driver
|
||||||
mediaManager media.Manager
|
mediaManager media.Manager
|
||||||
federator federation.Federator
|
federator federation.Federator
|
||||||
processor processing.Processor
|
processor *processing.Processor
|
||||||
emailSender email.Sender
|
emailSender email.Sender
|
||||||
sentEmails map[string]string
|
sentEmails map[string]string
|
||||||
|
|
||||||
|
|
|
@ -160,7 +160,7 @@ func (m *Module) ReportsGETHandler(c *gin.Context) {
|
||||||
limit = i
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -62,10 +62,10 @@
|
||||||
)
|
)
|
||||||
|
|
||||||
type Module struct {
|
type Module struct {
|
||||||
processor processing.Processor
|
processor *processing.Processor
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(processor processing.Processor) *Module {
|
func New(processor *processing.Processor) *Module {
|
||||||
return &Module{
|
return &Module{
|
||||||
processor: processor,
|
processor: processor,
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ type SearchStandardTestSuite struct {
|
||||||
storage *storage.Driver
|
storage *storage.Driver
|
||||||
mediaManager media.Manager
|
mediaManager media.Manager
|
||||||
federator federation.Federator
|
federator federation.Federator
|
||||||
processor processing.Processor
|
processor *processing.Processor
|
||||||
emailSender email.Sender
|
emailSender email.Sender
|
||||||
sentEmails map[string]string
|
sentEmails map[string]string
|
||||||
|
|
||||||
|
|
|
@ -68,10 +68,10 @@
|
||||||
)
|
)
|
||||||
|
|
||||||
type Module struct {
|
type Module struct {
|
||||||
processor processing.Processor
|
processor *processing.Processor
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(processor processing.Processor) *Module {
|
func New(processor *processing.Processor) *Module {
|
||||||
return &Module{
|
return &Module{
|
||||||
processor: processor,
|
processor: processor,
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ type StatusStandardTestSuite struct {
|
||||||
mediaManager media.Manager
|
mediaManager media.Manager
|
||||||
federator federation.Federator
|
federator federation.Federator
|
||||||
emailSender email.Sender
|
emailSender email.Sender
|
||||||
processor processing.Processor
|
processor *processing.Processor
|
||||||
storage *storage.Driver
|
storage *storage.Driver
|
||||||
|
|
||||||
// standard suite models
|
// standard suite models
|
||||||
|
|
|
@ -88,7 +88,7 @@ func (m *Module) StatusBookmarkPOSTHandler(c *gin.Context) {
|
||||||
return
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -91,7 +91,7 @@ func (m *Module) StatusBoostPOSTHandler(c *gin.Context) {
|
||||||
return
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -79,7 +79,7 @@ func (m *Module) StatusBoostedByGETHandler(c *gin.Context) {
|
||||||
return
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -90,7 +90,7 @@ func (m *Module) StatusContextGETHandler(c *gin.Context) {
|
||||||
return
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -104,7 +104,7 @@ func (m *Module) StatusCreatePOSTHandler(c *gin.Context) {
|
||||||
return
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -90,7 +90,7 @@ func (m *Module) StatusDELETEHandler(c *gin.Context) {
|
||||||
return
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -87,7 +87,7 @@ func (m *Module) StatusFavePOSTHandler(c *gin.Context) {
|
||||||
return
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -88,7 +88,7 @@ func (m *Module) StatusFavedByGETHandler(c *gin.Context) {
|
||||||
return
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -87,7 +87,7 @@ func (m *Module) StatusGETHandler(c *gin.Context) {
|
||||||
return
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -88,7 +88,7 @@ func (m *Module) StatusUnbookmarkPOSTHandler(c *gin.Context) {
|
||||||
return
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -88,7 +88,7 @@ func (m *Module) StatusUnboostPOSTHandler(c *gin.Context) {
|
||||||
return
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -87,7 +87,7 @@ func (m *Module) StatusUnfavePOSTHandler(c *gin.Context) {
|
||||||
return
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
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 {
|
if errWithCode != nil {
|
||||||
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1)
|
||||||
return
|
return
|
||||||
|
|
|
@ -42,12 +42,12 @@
|
||||||
)
|
)
|
||||||
|
|
||||||
type Module struct {
|
type Module struct {
|
||||||
processor processing.Processor
|
processor *processing.Processor
|
||||||
dTicker time.Duration
|
dTicker time.Duration
|
||||||
wsUpgrade websocket.Upgrader
|
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{
|
return &Module{
|
||||||
processor: processor,
|
processor: processor,
|
||||||
dTicker: dTicker,
|
dTicker: dTicker,
|
||||||
|
|
|
@ -54,7 +54,7 @@ type StreamingTestSuite struct {
|
||||||
mediaManager media.Manager
|
mediaManager media.Manager
|
||||||
federator federation.Federator
|
federator federation.Federator
|
||||||
emailSender email.Sender
|
emailSender email.Sender
|
||||||
processor processing.Processor
|
processor *processing.Processor
|
||||||
storage *storage.Driver
|
storage *storage.Driver
|
||||||
|
|
||||||
// standard suite models
|
// standard suite models
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue