visibility

package
v0.17.2 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: 13 Imported by: 0

Documentation

Index

Constants

View Source
const NoAuth = "noauth"

NoAuth is a placeholder ID used in cache lookups when there is no authorized account ID to use.

Variables

This section is empty.

Functions

This section is empty.

Types

type Filter

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

Filter packages up a bunch of logic for checking whether given statuses or accounts are visible to a requester.

func NewFilter

func NewFilter(state *state.State) *Filter

NewFilter returns a new Filter interface that will use the provided database.

func (*Filter) AccountVisible

func (f *Filter) AccountVisible(ctx context.Context, requester *gtsmodel.Account, account *gtsmodel.Account) (bool, error)

AccountVisible will check if given account is visible to requester, accounting for requester with no auth (i.e is nil), suspensions, disabled local users and account blocks.

func (*Filter) StatusHomeTimelineable

func (f *Filter) StatusHomeTimelineable(ctx context.Context, owner *gtsmodel.Account, status *gtsmodel.Status) (bool, error)

StatusHomeTimelineable checks if given status should be included on owner's home timeline. Primarily relying on status visibility to owner and the AP visibility setting, but also taking into account thread replies etc. Despite the name, statuses that ultimately end up in exclusive lists also need to be home-timelineable.

func (*Filter) StatusPublicTimelineable

func (f *Filter) StatusPublicTimelineable(ctx context.Context, requester *gtsmodel.Account, status *gtsmodel.Status) (bool, error)

StatusHomeTimelineable checks if given status should be included on requester's public timeline. Primarily relying on status visibility to requester and the AP visibility setting, and ignoring conversation threads.

func (*Filter) StatusTagTimelineable

func (f *Filter) StatusTagTimelineable(
	ctx context.Context,
	requester *gtsmodel.Account,
	status *gtsmodel.Status,
) (bool, error)

StatusHomeTimelineable checks if given status should be included on requester's tag timeline, primarily relying on status visibility to requester and the AP visibility setting.

func (*Filter) StatusVisible

func (f *Filter) StatusVisible(
	ctx context.Context,
	requester *gtsmodel.Account,
	status *gtsmodel.Status,
) (bool, error)

StatusVisible will check if status is visible to requester, accounting for requester with no auth (i.e is nil), suspensions, disabled local users, pending approvals, account blocks, and status visibility settings.

func (*Filter) StatusesVisible

func (f *Filter) StatusesVisible(ctx context.Context, requester *gtsmodel.Account, statuses []*gtsmodel.Status) ([]*gtsmodel.Status, error)

StatusesVisible calls StatusVisible for each status in the statuses slice, and returns a slice of only statuses which are visible to the requester.

Jump to

Keyboard shortcuts

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