diff options
author | 2023-02-22 16:05:26 +0100 | |
---|---|---|
committer | 2023-02-22 16:05:26 +0100 | |
commit | b6fbdc66c1ce1ec61ebfb6fcc0351ea627a1d288 (patch) | |
tree | c79d1107375597ab8a79045c80dd62dc95a204e7 /internal/processing/status/status.go | |
parent | [bugfix] Remove initial storage cleanup (#1545) (diff) | |
download | gotosocial-b6fbdc66c1ce1ec61ebfb6fcc0351ea627a1d288.tar.xz |
[chore] Deinterface processor and subprocessors (#1501)
* [chore] Deinterface processor and subprocessors
* expose subprocessors via function calls
* missing license header
Diffstat (limited to 'internal/processing/status/status.go')
-rw-r--r-- | internal/processing/status/status.go | 46 |
1 files changed, 2 insertions, 44 deletions
diff --git a/internal/processing/status/status.go b/internal/processing/status/status.go index 56b8b23eb..c91fd85d1 100644 --- a/internal/processing/status/status.go +++ b/internal/processing/status/status.go @@ -19,12 +19,8 @@ package status import ( - "context" - - apimodel "github.com/superseriousbusiness/gotosocial/internal/api/model" "github.com/superseriousbusiness/gotosocial/internal/concurrency" "github.com/superseriousbusiness/gotosocial/internal/db" - "github.com/superseriousbusiness/gotosocial/internal/gtserror" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/messages" "github.com/superseriousbusiness/gotosocial/internal/text" @@ -32,45 +28,7 @@ import ( "github.com/superseriousbusiness/gotosocial/internal/visibility" ) -// Processor wraps a bunch of functions for processing statuses. -type Processor interface { - // Create processes the given form to create a new status, returning the api model representation of that status if it's OK. - Create(ctx context.Context, account *gtsmodel.Account, application *gtsmodel.Application, form *apimodel.AdvancedStatusCreateForm) (*apimodel.Status, gtserror.WithCode) - // Delete processes the delete of a given status, returning the deleted status if the delete goes through. - Delete(ctx context.Context, account *gtsmodel.Account, targetStatusID string) (*apimodel.Status, gtserror.WithCode) - // Fave processes the faving of a given status, returning the updated status if the fave goes through. - Fave(ctx context.Context, account *gtsmodel.Account, targetStatusID string) (*apimodel.Status, gtserror.WithCode) - // Boost processes the boost/reblog of a given status, returning the newly-created boost if all is well. - Boost(ctx context.Context, account *gtsmodel.Account, application *gtsmodel.Application, targetStatusID string) (*apimodel.Status, gtserror.WithCode) - // Unboost processes the unboost/unreblog of a given status, returning the status if all is well. - Unboost(ctx context.Context, account *gtsmodel.Account, application *gtsmodel.Application, targetStatusID string) (*apimodel.Status, gtserror.WithCode) - // BoostedBy returns a slice of accounts that have boosted the given status, filtered according to privacy settings. - BoostedBy(ctx context.Context, account *gtsmodel.Account, targetStatusID string) ([]*apimodel.Account, gtserror.WithCode) - // FavedBy returns a slice of accounts that have liked the given status, filtered according to privacy settings. - FavedBy(ctx context.Context, account *gtsmodel.Account, targetStatusID string) ([]*apimodel.Account, gtserror.WithCode) - // Get gets the given status, taking account of privacy settings and blocks etc. - Get(ctx context.Context, account *gtsmodel.Account, targetStatusID string) (*apimodel.Status, gtserror.WithCode) - // Unfave processes the unfaving of a given status, returning the updated status if the fave goes through. - Unfave(ctx context.Context, account *gtsmodel.Account, targetStatusID string) (*apimodel.Status, gtserror.WithCode) - // Context returns the context (previous and following posts) from the given status ID - Context(ctx context.Context, account *gtsmodel.Account, targetStatusID string) (*apimodel.Context, gtserror.WithCode) - // Bookmarks a status - Bookmark(ctx context.Context, account *gtsmodel.Account, targetStatusID string) (*apimodel.Status, gtserror.WithCode) - // Removes a bookmark for a status - Unbookmark(ctx context.Context, account *gtsmodel.Account, targetStatusID string) (*apimodel.Status, gtserror.WithCode) - - /* - PROCESSING UTILS - */ - - ProcessVisibility(ctx context.Context, form *apimodel.AdvancedStatusCreateForm, accountDefaultVis gtsmodel.Visibility, status *gtsmodel.Status) error - ProcessReplyToID(ctx context.Context, form *apimodel.AdvancedStatusCreateForm, thisAccountID string, status *gtsmodel.Status) gtserror.WithCode - ProcessMediaIDs(ctx context.Context, form *apimodel.AdvancedStatusCreateForm, thisAccountID string, status *gtsmodel.Status) gtserror.WithCode - ProcessLanguage(ctx context.Context, form *apimodel.AdvancedStatusCreateForm, accountDefaultLanguage string, status *gtsmodel.Status) error - ProcessContent(ctx context.Context, form *apimodel.AdvancedStatusCreateForm, accountID string, status *gtsmodel.Status) error -} - -type processor struct { +type Processor struct { tc typeutils.TypeConverter db db.DB filter visibility.Filter @@ -81,7 +39,7 @@ type processor struct { // New returns a new status processor. func New(db db.DB, tc typeutils.TypeConverter, clientWorker *concurrency.WorkerPool[messages.FromClientAPI], parseMention gtsmodel.ParseMentionFunc) Processor { - return &processor{ + return Processor{ tc: tc, db: db, filter: visibility.NewFilter(db), |