account

package
v0.17.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2024 License: AGPL-3.0 Imports: 45 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GetRSSFeed added in v0.10.0

type GetRSSFeed func() (string, gtserror.WithCode)

type Processor

type Processor struct {
	// contains filtered or unexported fields
}

Processor wraps functionality for updating, creating, and deleting accounts in response to API requests.

It also contains logic for actions towards accounts such as following, blocking, seeing follows, etc.

func New

func New(
	common *common.Processor,
	state *state.State,
	converter *typeutils.Converter,
	mediaManager *media.Manager,
	federator *federation.Federator,
	visFilter *visibility.Filter,
	parseMention gtsmodel.ParseMentionFunc,
) Processor

New returns a new account processor.

func (*Processor) Alias added in v0.14.0

func (p *Processor) Alias(
	ctx context.Context,
	account *gtsmodel.Account,
	newAKAURIStrs []string,
) (*apimodel.Account, gtserror.WithCode)

func (*Processor) BlockCreate

func (p *Processor) BlockCreate(ctx context.Context, requestingAccount *gtsmodel.Account, targetAccountID string) (*apimodel.Relationship, gtserror.WithCode)

BlockCreate handles the creation of a block from requestingAccount to targetAccountID, either remote or local.

func (*Processor) BlockRemove

func (p *Processor) BlockRemove(ctx context.Context, requestingAccount *gtsmodel.Account, targetAccountID string) (*apimodel.Relationship, gtserror.WithCode)

BlockRemove handles the removal of a block from requestingAccount to targetAccountID, either remote or local.

func (*Processor) BlocksGet added in v0.12.0

func (p *Processor) BlocksGet(
	ctx context.Context,
	requestingAccount *gtsmodel.Account,
	page *paging.Page,
) (*apimodel.PageableResponse, gtserror.WithCode)

BlocksGet ...

func (*Processor) BookmarksGet added in v0.7.0

func (p *Processor) BookmarksGet(ctx context.Context, requestingAccount *gtsmodel.Account, limit int, maxID string, minID string) (*apimodel.PageableResponse, gtserror.WithCode)

BookmarksGet returns a pageable response of statuses that are bookmarked by requestingAccount. Paging for this response is done based on bookmark ID rather than status ID.

func (*Processor) DefaultInteractionPoliciesGet added in v0.17.0

func (p *Processor) DefaultInteractionPoliciesGet(
	ctx context.Context,
	requester *gtsmodel.Account,
) (*apimodel.DefaultPolicies, gtserror.WithCode)

func (*Processor) DefaultInteractionPoliciesUpdate added in v0.17.0

func (p *Processor) DefaultInteractionPoliciesUpdate(
	ctx context.Context,
	requester *gtsmodel.Account,
	form *apimodel.UpdateInteractionPoliciesRequest,
) (*apimodel.DefaultPolicies, gtserror.WithCode)

func (*Processor) Delete

func (p *Processor) Delete(
	ctx context.Context,
	account *gtsmodel.Account,
	origin string,
) gtserror.WithCode

Delete deletes an account, and all of that account's statuses, media, follows, notifications, etc etc etc. The origin passed here should be either the ID of the account doing the delete (can be itself), or the ID of a domain block.

func (*Processor) ExportBlocks added in v0.17.0

func (p *Processor) ExportBlocks(
	ctx context.Context,
	requester *gtsmodel.Account,
) ([][]string, gtserror.WithCode)

ExportBlocks returns a CSV file of account blocks created by the requester.

func (*Processor) ExportFollowers added in v0.17.0

func (p *Processor) ExportFollowers(
	ctx context.Context,
	requester *gtsmodel.Account,
) ([][]string, gtserror.WithCode)

ExportFollowers returns a CSV file of accounts that follow the requester.

func (*Processor) ExportFollowing added in v0.17.0

func (p *Processor) ExportFollowing(
	ctx context.Context,
	requester *gtsmodel.Account,
) ([][]string, gtserror.WithCode)

ExportFollowing returns a CSV file of accounts that the requester follows.

func (*Processor) ExportLists added in v0.17.0

func (p *Processor) ExportLists(
	ctx context.Context,
	requester *gtsmodel.Account,
) ([][]string, gtserror.WithCode)

ExportLists returns a CSV file of lists created by the requester.

func (*Processor) ExportMutes added in v0.17.0

func (p *Processor) ExportMutes(
	ctx context.Context,
	requester *gtsmodel.Account,
) ([][]string, gtserror.WithCode)

ExportMutes returns a CSV file of account mutes created by the requester.

func (*Processor) ExportStats added in v0.17.0

func (p *Processor) ExportStats(
	ctx context.Context,
	requester *gtsmodel.Account,
) (*apimodel.AccountExportStats, gtserror.WithCode)

ExportStats returns the requester's export stats, ie., the counts of items that can be exported.

func (*Processor) FollowCreate

func (p *Processor) FollowCreate(ctx context.Context, requestingAccount *gtsmodel.Account, form *apimodel.AccountFollowRequest) (*apimodel.Relationship, gtserror.WithCode)

FollowCreate handles a follow request to an account, either remote or local.

func (*Processor) FollowRemove

func (p *Processor) FollowRemove(ctx context.Context, requestingAccount *gtsmodel.Account, targetAccountID string) (*apimodel.Relationship, gtserror.WithCode)

FollowRemove handles the removal of a follow/follow request to an account, either remote or local.

func (*Processor) FollowRequestAccept added in v0.12.0

func (p *Processor) FollowRequestAccept(ctx context.Context, requestingAccount *gtsmodel.Account, sourceAccountID string) (*apimodel.Relationship, gtserror.WithCode)

FollowRequestAccept handles the accepting of a follow request from the sourceAccountID to the requestingAccount (the currently authorized account).

func (*Processor) FollowRequestReject added in v0.12.0

func (p *Processor) FollowRequestReject(ctx context.Context, requestingAccount *gtsmodel.Account, sourceAccountID string) (*apimodel.Relationship, gtserror.WithCode)

FollowRequestReject handles the rejection of a follow request from the sourceAccountID to the requestingAccount (the currently authorized account).

func (*Processor) FollowRequestsGet added in v0.12.0

func (p *Processor) FollowRequestsGet(ctx context.Context, requestingAccount *gtsmodel.Account, page *paging.Page) (*apimodel.PageableResponse, gtserror.WithCode)

FollowRequestsGet fetches a list of the accounts that are follow requesting the given requestingAccount (the currently authorized account).

func (*Processor) FollowersGet

func (p *Processor) FollowersGet(ctx context.Context, requestingAccount *gtsmodel.Account, targetAccountID string, page *paging.Page) (*apimodel.PageableResponse, gtserror.WithCode)

FollowersGet fetches a list of the target account's followers.

func (*Processor) FollowingGet

func (p *Processor) FollowingGet(ctx context.Context, requestingAccount *gtsmodel.Account, targetAccountID string, page *paging.Page) (*apimodel.PageableResponse, gtserror.WithCode)

FollowingGet fetches a list of the accounts that target account is following.

func (*Processor) Get

func (p *Processor) Get(ctx context.Context, requestingAccount *gtsmodel.Account, targetAccountID string) (*apimodel.Account, gtserror.WithCode)

Get processes the given request for account information.

func (*Processor) GetCustomCSSForUsername added in v0.5.0

func (p *Processor) GetCustomCSSForUsername(ctx context.Context, username string) (string, gtserror.WithCode)

GetCustomCSSForUsername returns custom css for the given local username.

func (*Processor) GetRSSFeedForUsername added in v0.6.0

func (p *Processor) GetRSSFeedForUsername(ctx context.Context, username string) (GetRSSFeed, time.Time, gtserror.WithCode)

GetRSSFeedForUsername returns a function to return the RSS feed of a local account with the given username, and the last-modified time (time that the account last posted a status eligible to be included in the rss feed).

To save db calls, callers to this function should only call the returned GetRSSFeed func if the last-modified time is newer than the last-modified time they have cached.

If the account has not yet posted an RSS-eligible status, the returned last-modified time will be zero, and the GetRSSFeed func will return a valid RSS xml with no items.

func (*Processor) GetWeb added in v0.17.0

func (p *Processor) GetWeb(ctx context.Context, username string) (*apimodel.WebAccount, gtserror.WithCode)

GetWeb returns the web model of a local account by username.

func (*Processor) ImportData added in v0.17.0

func (p *Processor) ImportData(
	ctx context.Context,
	requester *gtsmodel.Account,
	data *multipart.FileHeader,
	importType string,
	overwrite bool,
) gtserror.WithCode

func (*Processor) ListsGet added in v0.10.0

func (p *Processor) ListsGet(ctx context.Context, requestingAccount *gtsmodel.Account, targetAccountID string) ([]*apimodel.List, gtserror.WithCode)

ListsGet returns all lists owned by requestingAccount, which contain a follow for targetAccountID.

func (*Processor) MoveSelf added in v0.14.0

func (p *Processor) MoveSelf(
	ctx context.Context,
	authed *oauth.Auth,
	form *apimodel.AccountMoveRequest,
) gtserror.WithCode

func (*Processor) MuteCreate added in v0.16.0

func (p *Processor) MuteCreate(
	ctx context.Context,
	requestingAccount *gtsmodel.Account,
	targetAccountID string,
	form *apimodel.UserMuteCreateUpdateRequest,
) (*apimodel.Relationship, gtserror.WithCode)

MuteCreate handles the creation or updating of a mute from requestingAccount to targetAccountID. The form params should have already been normalized by the time they reach this function.

func (*Processor) MuteRemove added in v0.16.0

func (p *Processor) MuteRemove(
	ctx context.Context,
	requestingAccount *gtsmodel.Account,
	targetAccountID string,
) (*apimodel.Relationship, gtserror.WithCode)

MuteRemove handles the removal of a mute from requestingAccount to targetAccountID.

func (*Processor) MutesGet added in v0.16.0

func (p *Processor) MutesGet(
	ctx context.Context,
	requestingAccount *gtsmodel.Account,
	page *paging.Page,
) (*apimodel.PageableResponse, gtserror.WithCode)

MutesGet retrieves the user's list of muted accounts, with an extra field for mute expiration (if applicable).

func (*Processor) PutNote added in v0.11.0

func (p *Processor) PutNote(ctx context.Context, requestingAccount *gtsmodel.Account, targetAccountID string, comment string) (*apimodel.Relationship, gtserror.WithCode)

PutNote updates the requesting account's private note on the target account.

func (*Processor) RelationshipGet

func (p *Processor) RelationshipGet(ctx context.Context, requestingAccount *gtsmodel.Account, targetAccountID string) (*apimodel.Relationship, gtserror.WithCode)

RelationshipGet returns a relationship model describing the relationship of the targetAccount to the Authed account.

func (*Processor) StatusesGet

func (p *Processor) StatusesGet(
	ctx context.Context,
	requestingAccount *gtsmodel.Account,
	targetAccountID string,
	limit int,
	excludeReplies bool,
	excludeReblogs bool,
	maxID string,
	minID string,
	pinned bool,
	mediaOnly bool,
	publicOnly bool,
) (*apimodel.PageableResponse, gtserror.WithCode)

StatusesGet fetches a number of statuses (in time descending order) from the target account, filtered by visibility according to the requesting account.

func (*Processor) ThemesGet added in v0.15.0

func (p *Processor) ThemesGet() []apimodel.Theme

GetThemes returns available account css themes.

func (*Processor) Update

Update processes the update of an account with the given form.

func (*Processor) UpdateAvatar

func (p *Processor) UpdateAvatar(
	ctx context.Context,
	account *gtsmodel.Account,
	avatar *multipart.FileHeader,
	description *string,
) (
	*gtsmodel.MediaAttachment,
	gtserror.WithCode,
)

UpdateAvatar does the dirty work of checking the avatar part of an account update form, parsing and checking the media, and doing the necessary updates in the database for this to become the account's new avatar.

func (*Processor) UpdateHeader

func (p *Processor) UpdateHeader(
	ctx context.Context,
	account *gtsmodel.Account,
	header *multipart.FileHeader,
	description *string,
) (
	*gtsmodel.MediaAttachment,
	gtserror.WithCode,
)

UpdateHeader does the dirty work of checking the header part of an account update form, parsing and checking the media, and doing the necessary updates in the database for this to become the account's new header.

func (*Processor) WebStatusesGet added in v0.3.8

func (p *Processor) WebStatusesGet(
	ctx context.Context,
	targetAccountID string,
	maxID string,
) (*apimodel.PageableResponse, gtserror.WithCode)

WebStatusesGet fetches a number of statuses (in descending order) from the given account. It selects only statuses which are suitable for showing on the public web profile of an account.

func (*Processor) WebStatusesGetPinned added in v0.13.0

func (p *Processor) WebStatusesGetPinned(
	ctx context.Context,
	targetAccountID string,
) ([]*apimodel.WebStatus, gtserror.WithCode)

WebStatusesGetPinned returns web versions of pinned statuses.

type Themes added in v0.15.0

type Themes struct {
	// Themes sorted alphabetically
	// by title (case insensitive).
	SortedByTitle []*gtsmodel.Theme

	// ByFileName contains themes retrievable
	// by their filename eg., `light-blurple.css`.
	ByFileName map[string]*gtsmodel.Theme
}

Themes represents an in-memory storage structure for themes.

func PopulateThemes added in v0.15.0

func PopulateThemes() *Themes

PopulateThemes parses available account CSS themes from the web assets themes directory.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL