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 ¶
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 ¶
Delete handles POST /api/blocking/delete.
同じく upstream TS は 200 + UserDetailed (isBlocking=false 反映) を返す。 userRepo 未 wire 時は 204 No Content フォールバック (#870)。
func (*Handler) List ¶
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 ¶
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.