Documentation ¶
Index ¶
- func TopoSort(statuses []*gtsmodel.Status, contextAcctID string)
- type Processor
- func (p *Processor) BookmarkCreate(ctx context.Context, requestingAccount *gtsmodel.Account, ...) (*apimodel.Status, gtserror.WithCode)
- func (p *Processor) BookmarkRemove(ctx context.Context, requestingAccount *gtsmodel.Account, ...) (*apimodel.Status, gtserror.WithCode)
- func (p *Processor) BoostCreate(ctx context.Context, requester *gtsmodel.Account, ...) (*apimodel.Status, gtserror.WithCode)
- func (p *Processor) BoostRemove(ctx context.Context, requester *gtsmodel.Account, ...) (*apimodel.Status, gtserror.WithCode)
- func (p *Processor) ContextGet(ctx context.Context, requester *gtsmodel.Account, targetStatusID string) (*apimodel.ThreadContext, gtserror.WithCode)
- func (p *Processor) Create(ctx context.Context, requester *gtsmodel.Account, ...) (*apimodel.Status, gtserror.WithCode)
- func (p *Processor) Delete(ctx context.Context, requestingAccount *gtsmodel.Account, ...) (*apimodel.Status, gtserror.WithCode)
- func (p *Processor) FaveCreate(ctx context.Context, requester *gtsmodel.Account, targetStatusID string) (*apimodel.Status, gtserror.WithCode)
- func (p *Processor) FaveRemove(ctx context.Context, requestingAccount *gtsmodel.Account, ...) (*apimodel.Status, gtserror.WithCode)
- func (p *Processor) FavedBy(ctx context.Context, requestingAccount *gtsmodel.Account, ...) ([]*apimodel.Account, gtserror.WithCode)
- func (p *Processor) Get(ctx context.Context, requestingAccount *gtsmodel.Account, ...) (*apimodel.Status, gtserror.WithCode)
- func (p *Processor) HistoryGet(ctx context.Context, requestingAccount *gtsmodel.Account, ...) ([]*apimodel.StatusEdit, gtserror.WithCode)
- func (p *Processor) MuteCreate(ctx context.Context, requestingAccount *gtsmodel.Account, ...) (*apimodel.Status, gtserror.WithCode)
- func (p *Processor) MuteRemove(ctx context.Context, requestingAccount *gtsmodel.Account, ...) (*apimodel.Status, gtserror.WithCode)
- func (p *Processor) PinCreate(ctx context.Context, requestingAccount *gtsmodel.Account, ...) (*apimodel.Status, gtserror.WithCode)
- func (p *Processor) PinRemove(ctx context.Context, requestingAccount *gtsmodel.Account, ...) (*apimodel.Status, gtserror.WithCode)
- func (p *Processor) SourceGet(ctx context.Context, requestingAccount *gtsmodel.Account, ...) (*apimodel.StatusSource, gtserror.WithCode)
- func (p *Processor) StatusBoostedBy(ctx context.Context, requestingAccount *gtsmodel.Account, ...) ([]*apimodel.Account, gtserror.WithCode)
- func (p *Processor) WebContextGet(ctx context.Context, targetStatusID string) (*apimodel.WebThreadContext, gtserror.WithCode)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TopoSort ¶ added in v0.14.0
TopoSort sorts the given slice of *descendant* statuses topologically, by self-reply, and by ID.
"contextAcctID" should be the ID of the account that owns the status the thread context is being constructed around.
Can handle cycles but the output order will be arbitrary. (But if there are cycles, something went wrong upstream.)
Types ¶
type Processor ¶
type Processor struct {
// contains filtered or unexported fields
}
func New ¶
func New( state *state.State, common *common.Processor, polls *polls.Processor, intReqs *interactionrequests.Processor, federator *federation.Federator, converter *typeutils.Converter, visFilter *visibility.Filter, intFilter *interaction.Filter, parseMention gtsmodel.ParseMentionFunc, ) Processor
New returns a new status processor.
func (*Processor) BookmarkCreate ¶ added in v0.8.0
func (p *Processor) BookmarkCreate(ctx context.Context, requestingAccount *gtsmodel.Account, targetStatusID string) (*apimodel.Status, gtserror.WithCode)
BookmarkCreate adds a bookmark for the requestingAccount, targeting the given status (no-op if bookmark already exists).
func (*Processor) BookmarkRemove ¶ added in v0.8.0
func (p *Processor) BookmarkRemove(ctx context.Context, requestingAccount *gtsmodel.Account, targetStatusID string) (*apimodel.Status, gtserror.WithCode)
BookmarkRemove removes a bookmark for the requesting account, targeting the given status (no-op if bookmark doesn't exist).
func (*Processor) BoostCreate ¶ added in v0.8.0
func (p *Processor) BoostCreate( ctx context.Context, requester *gtsmodel.Account, application *gtsmodel.Application, targetID string, ) (*apimodel.Status, gtserror.WithCode)
BoostCreate processes the boost/reblog of target status, returning the newly-created boost.
func (*Processor) BoostRemove ¶ added in v0.8.0
func (p *Processor) BoostRemove( ctx context.Context, requester *gtsmodel.Account, application *gtsmodel.Application, targetID string, ) (*apimodel.Status, gtserror.WithCode)
BoostRemove processes the unboost/unreblog of target status, returning the target status.
func (*Processor) ContextGet ¶ added in v0.8.0
func (p *Processor) ContextGet( ctx context.Context, requester *gtsmodel.Account, targetStatusID string, ) (*apimodel.ThreadContext, gtserror.WithCode)
ContextGet returns the context (previous and following posts) from the given status ID.
func (*Processor) Create ¶
func (p *Processor) Create( ctx context.Context, requester *gtsmodel.Account, application *gtsmodel.Application, form *apimodel.StatusCreateRequest, ) ( *apimodel.Status, gtserror.WithCode, )
Create processes the given form to create a new status, returning the api model representation of that status if it's OK.
Precondition: the form's fields should have already been validated and normalized by the caller.
func (*Processor) Delete ¶
func (p *Processor) Delete(ctx context.Context, requestingAccount *gtsmodel.Account, targetStatusID string) (*apimodel.Status, gtserror.WithCode)
Delete processes the delete of a given status, returning the deleted status if the delete goes through.
func (*Processor) FaveCreate ¶ added in v0.8.0
func (p *Processor) FaveCreate( ctx context.Context, requester *gtsmodel.Account, targetStatusID string, ) (*apimodel.Status, gtserror.WithCode)
FaveCreate adds a fave for the requestingAccount, targeting the given status (no-op if fave already exists).
func (*Processor) FaveRemove ¶ added in v0.8.0
func (p *Processor) FaveRemove(ctx context.Context, requestingAccount *gtsmodel.Account, targetStatusID string) (*apimodel.Status, gtserror.WithCode)
FaveRemove removes a fave for the requesting account, targeting the given status (no-op if fave doesn't exist).
func (*Processor) FavedBy ¶
func (p *Processor) FavedBy(ctx context.Context, requestingAccount *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.
func (*Processor) Get ¶
func (p *Processor) Get(ctx context.Context, requestingAccount *gtsmodel.Account, targetStatusID string) (*apimodel.Status, gtserror.WithCode)
Get gets the given status, taking account of privacy settings and blocks etc.
func (*Processor) HistoryGet ¶ added in v0.16.0
func (p *Processor) HistoryGet(ctx context.Context, requestingAccount *gtsmodel.Account, targetStatusID string) ([]*apimodel.StatusEdit, gtserror.WithCode)
HistoryGet gets edit history for the target status, taking account of privacy settings and blocks etc. TODO: currently this just returns the latest version of the status.
func (*Processor) MuteCreate ¶ added in v0.13.0
func (*Processor) MuteRemove ¶ added in v0.13.0
func (*Processor) PinCreate ¶ added in v0.8.0
func (p *Processor) PinCreate(ctx context.Context, requestingAccount *gtsmodel.Account, targetStatusID string) (*apimodel.Status, gtserror.WithCode)
PinCreate pins the target status to the top of requestingAccount's profile, if possible.
Conditions for a pin to work:
- Status belongs to requesting account.
- Status is public, unlisted, or followers-only.
- Status is not a boost.
- Status is not already pinnd.
- Limit of pinned statuses not yet met or exceeded.
If the conditions can't be met, then code 422 Unprocessable Entity will be returned.
func (*Processor) PinRemove ¶ added in v0.8.0
func (p *Processor) PinRemove(ctx context.Context, requestingAccount *gtsmodel.Account, targetStatusID string) (*apimodel.Status, gtserror.WithCode)
PinRemove unpins the target status from the top of requestingAccount's profile, if possible.
Conditions for an unpin to work:
- Status belongs to requesting account.
- Status is public, unlisted, or followers-only.
- Status is not a boost.
If the conditions can't be met, then code 422 Unprocessable Entity will be returned.
Unlike with PinCreate, statuses that are already unpinned will not return 422, but just do nothing and return the api model representation of the status, to conform to the masto API.
func (*Processor) SourceGet ¶ added in v0.16.0
func (p *Processor) SourceGet(ctx context.Context, requestingAccount *gtsmodel.Account, targetStatusID string) (*apimodel.StatusSource, gtserror.WithCode)
SourceGet returns the *apimodel.StatusSource version of the targetStatusID. Status must belong to the requester, and must not be a boost.
func (*Processor) StatusBoostedBy ¶ added in v0.8.0
func (p *Processor) StatusBoostedBy(ctx context.Context, requestingAccount *gtsmodel.Account, targetStatusID string) ([]*apimodel.Account, gtserror.WithCode)
StatusBoostedBy returns a slice of accounts that have boosted the given status, filtered according to privacy settings.
func (*Processor) WebContextGet ¶ added in v0.13.0
func (p *Processor) WebContextGet( ctx context.Context, targetStatusID string, ) (*apimodel.WebThreadContext, gtserror.WithCode)
WebContextGet is like ContextGet, but is explicitly for viewing statuses via the unauthenticated web UI.
The returned statuses in the ThreadContext will be populated with ThreadMeta annotations for more easily positioning the status in a web view of a thread.