blocking

package
v0.0.0-...-9914b64 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: AGPL-3.0 Imports: 16 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package blocking provides /api/blocking/* endpoints.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

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

Handler handles blocking-related API endpoints.

func NewHandler

func NewHandler(svc *coreblocking.Service, userRepo repository.UserRepository, idGen id.Generator, entityPacker *entity.Packer, extras userpack.DetailExtrasMany, packer UserPacker) *Handler

NewHandler creates a new blocking Handler. userRepo / idGen are required by blocking/list to embed the `blockee` user object that the upstream Misskey frontend renders. entityPacker is the Packer this handler packs entities with (#3792); extras fills pinnedNotes / pinnedPage / movedTo / alsoKnownAs for the embedded users of blocking/list (#3330); packer builds the create / delete response as the upstream UserDetailedNotMe (#3330).

func (*Handler) Create

func (h *Handler) Create(c *echo.Context) error

Create handles POST /api/blocking/create.

upstream Misskey TS と同じく成功時は 200 + 対象 blockee の UserDetailed (= isBlocking=true 反映) を返す。frontend (vue) が即時 redraw するため 必要 (#870)。userRepo が wire されない test stub では legacy 互換で 204 No Content にフォールバック。

func (*Handler) Delete

func (h *Handler) Delete(c *echo.Context) error

Delete handles POST /api/blocking/delete.

同じく upstream TS は 200 + UserDetailed (isBlocking=false 反映) を返す。 userRepo 未 wire 時は 204 No Content フォールバック (#870)。

func (*Handler) List

func (h *Handler) List(c *echo.Context) error

List handles POST /api/blocking/list.

frontend Paginator (cursor mode) は untilId / sinceId を forward する。 本 endpoint は #493 で cursor 対応に切り替えた。

func (*Handler) SetModeratorChecker

func (h *Handler) SetModeratorChecker(m ModeratorChecker)

SetModeratorChecker wires the moderator check used by blocking/list's count gate so a moderator viewer keeps seeing follower/following counts (#1985)。

func (*Handler) SetRelationRepos

func (h *Handler) SetRelationRepos(r userrelation.Repos)

SetRelationRepos wires the repositories used to compute the viewer->blockee relation block (isBlocking etc.) returned by create / delete (#1802). When unset the relation flags are simply omitted (= legacy 204-ish behavior for test fixtures).

type ListRequest

type ListRequest struct {
	Limit     *jsnum.Int `json:"limit"`
	SinceID   string     `json:"sinceId"`
	UntilID   string     `json:"untilId"`
	SinceDate *jsnum.Int `json:"sinceDate"`
	UntilDate *jsnum.Int `json:"untilDate"`
}

ListRequest is the request body for blocking/list.

本家の paramDef に offset は無く、送られても無視して先頭から返すので読まない。 limit / sinceDate / untilDate は、本家(ajv の integer)と同じく値が整数の 小数(10.0)を受ける (#3760)。

type ModeratorChecker

type ModeratorChecker interface {
	IsModerator(userID string) bool
}

ModeratorChecker reports whether a user holds moderator privileges. Used to let moderator viewers see follower/following counts that would otherwise be gated by visibility (mirrors upstream UserEntityService iAmModerator, #1985)。

type PairRequest

type PairRequest struct {
	UserID string `json:"userId"`
}

PairRequest is the request body for blocking/create and blocking/delete.

type UserPacker

type UserPacker interface {
	DetailedNotMe(ctx context.Context, target, viewer *model.User) (entity.UserDetailed, bool)
}

UserPacker packs a user as UserDetailedNotMe seen by viewer. *userpack.Packer satisfies it.

Jump to

Keyboard shortcuts

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