Documentation
¶
Index ¶
- func ParseAcct(acct, localHost string) (username string, host *string)
- func ValidListState(state string) bool
- type AbuseReportCreatedNotifier
- type ChartHook
- type FeaturedRankingReader
- type FollowersRequest
- type Handler
- func (h *Handler) Achievements(c *echo.Context) error
- func (h *Handler) Clips(c *echo.Context) error
- func (h *Handler) FeaturedNotes(c *echo.Context) error
- func (h *Handler) FillDetailedExtras(ctx context.Context, viewer, u *model.User, profile *model.UserProfile, ...)
- func (h *Handler) FillDetailedExtrasMany(ctx context.Context, viewer *model.User, targets []userpack.DetailTarget)
- func (h *Handler) Flashs(c *echo.Context) error
- func (h *Handler) Followers(c *echo.Context) error
- func (h *Handler) Following(c *echo.Context) error
- func (h *Handler) GalleryPosts(c *echo.Context) error
- func (h *Handler) GetFollowingUsersByBirthday(c *echo.Context) error
- func (h *Handler) GetFrequentlyRepliedUsers(c *echo.Context) error
- func (h *Handler) List(c *echo.Context) error
- func (h *Handler) ListsCreateFromPublic(c *echo.Context) error
- func (h *Handler) ListsFavorite(c *echo.Context) error
- func (h *Handler) ListsGetMemberships(c *echo.Context) error
- func (h *Handler) ListsUnfavorite(c *echo.Context) error
- func (h *Handler) ListsUpdate(c *echo.Context) error
- func (h *Handler) ListsUpdateMembership(c *echo.Context) error
- func (h *Handler) Notes(c *echo.Context) error
- func (h *Handler) OnlineCount(c *echo.Context) error
- func (h *Handler) Pages(c *echo.Context) error
- func (h *Handler) PinnedUsers(c *echo.Context) error
- func (h *Handler) Reactions(c *echo.Context) error
- func (h *Handler) Relation(c *echo.Context) error
- func (h *Handler) ReportAbuse(c *echo.Context) error
- func (h *Handler) Search(c *echo.Context) error
- func (h *Handler) SearchByUsernameAndHost(c *echo.Context) error
- func (h *Handler) SetAbuseRepo(r repository.AbuseReportRepository)
- func (h *Handler) SetAbuseReportCreatedNotifier(n AbuseReportCreatedNotifier)
- func (h *Handler) SetChartHook(c ChartHook)
- func (h *Handler) SetClipFavoriteRepo(r repository.ClipFavoriteRepository)
- func (h *Handler) SetClipNoteRepo(r repository.ClipNoteRepository)
- func (h *Handler) SetClipRepo(r repository.ClipRepository)
- func (h *Handler) SetDriveFileRepo(r repository.DriveFileRepository)
- func (h *Handler) SetEmojiRepo(r repository.EmojiRepository)
- func (h *Handler) SetFeaturedRanking(r FeaturedRankingReader)
- func (h *Handler) SetFlashRepo(r repository.FlashRepository)
- func (h *Handler) SetFollowRequestRepo(r repository.FollowRequestRepository)
- func (h *Handler) SetFollowingRepo(r repository.FollowingRepository)
- func (h *Handler) SetGalleryRepo(r repository.GalleryRepository)
- func (h *Handler) SetInstanceRepo(r repository.InstanceRepository)
- func (h *Handler) SetLocalHost(host string)
- func (h *Handler) SetMemoRepo(r repository.UserMemoRepository)
- func (h *Handler) SetModeratorChecker(m ModeratorChecker)
- func (h *Handler) SetNoteFieldResolver(r *entity.NoteFieldResolver)
- func (h *Handler) SetNoteReactionRepo(r repository.NoteReactionRepository)
- func (h *Handler) SetPageRepo(r repository.PageRepository)
- func (h *Handler) SetPiningRepo(r repository.UserNotePiningRepository)
- func (h *Handler) SetProxyFollow(p ProxyFollowEnqueuer)
- func (h *Handler) SetReactionReader(r entity.BufferedReactionsReader)
- func (h *Handler) SetRelationCache(rc *repository.RelationCache)
- func (h *Handler) SetRemoteStatsFetcher(f RemoteStatsFetcher)
- func (h *Handler) SetRenoteMutingRepo(r repository.RenoteMutingRepository)
- func (h *Handler) SetSelfPacker(p *meself.Packer)
- func (h *Handler) SetServerURL(u string)
- func (h *Handler) SetUGCVisibility(v string)
- func (h *Handler) SetUserListEventPublisher(p UserListMembershipEventPublisher)
- func (h *Handler) SetUserListFavoriteRepo(r UserListFavoriteRepository)
- func (h *Handler) SetUserListRepo(r repository.UserListRepository)
- func (h *Handler) SetUserRepo(r repository.UserRepository)
- func (h *Handler) Show(c *echo.Context) error
- func (h *Handler) UpdateMemo(c *echo.Context) error
- func (h *Handler) UserRecommendation(c *echo.Context) error
- func (h *Handler) UsersBulk(c *echo.Context) error
- type ModeratorChecker
- type NotesRequest
- type ProxyFollowEnqueuer
- type RemoteStatsFetcher
- type RemoteUserStatsView
- type SearchRequest
- type ShowRequest
- type UserListFavoriteRepository
- type UserListMembershipEventPublisher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseAcct ¶
ParseAcct splits an `@user@host` string into its username and host parts.
host は**自インスタンスなら nil** を返す (local user は host 列が NULL)。 先頭の `@` は付いていてもいなくてもよい。
**localHost はここで小文字化する。** `url.Parse(config.URL).Host` は host を 正規化しないので、呼び出し側に任せると `config.url` に大文字が混ざる構成で 経路ごとに local / remote の判定が食い違う (実際 avatar 側だけが小文字化 していて、pinned-users から `@user@Own.Example` が黙って消えていた、#2791)。
func ValidListState ¶
ValidListState reports whether state is an accepted value for the public /users listing. upstream users.ts:35 の state enum は ['all','alive'] (default 'all'); 空文字列は default 'all' として許容する。範囲外は ajv 同様に reject する想定 (#1996)。
Types ¶
type AbuseReportCreatedNotifier ¶
type AbuseReportCreatedNotifier interface {
NotifyCreated(ctx context.Context, report *model.AbuseUserReport, reporter, target *model.User)
}
AbuseReportCreatedNotifier tells moderators about a newly created report (in-app notification / admin stream / abuseReport system webhook)。実装は core/abuse.CreatedNotifier で、連合経由の Flag も同じものを呼ぶ (#3256)。
type ChartHook ¶
type ChartHook interface {
OnUserShow(ownerID, viewerID, visitorKey string)
}
ChartHook is invoked after a user/show request resolves so the chart subsystem can record the profile pageview and the activeUsers Read event. パッケージ間の循環依存を避けるため interface で受け取る (実装は core/chart/charthook)。
type FeaturedRankingReader ¶
type FeaturedRankingReader interface {
GetPerUserNotesRanking(ctx context.Context, userID string, threshold int) ([]string, error)
}
FeaturedRankingReader reads the per-user engagement ranking for users/featured-notes (#1687). 循環依存回避のため narrow interface (実装は core/featured.Service)。
type FollowersRequest ¶
type FollowersRequest struct {
// UserID は、本家と同じくキーがあるかで経路を分けるので、欠けと null と値を
// 見分ける (#3837)。
UserID optional.Nullable[string] `json:"userId"`
Username *string `json:"username"`
Host *string `json:"host"`
Limit *jsnum.Int `json:"limit"`
SinceID string `json:"sinceId"`
UntilID string `json:"untilId"`
SinceDate *jsnum.Int `json:"sinceDate"`
UntilDate *jsnum.Int `json:"untilDate"`
// contains filtered or unexported fields
}
FollowersRequest is the request body for users/followers and users/following. upstream paramDef anyOf で {userId} または {username, host} を受ける (#1547)。 offset は本家の paramDef に無いので、本家と同じく読まない (#3837)。
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler handles user-related API endpoints.
func NewHandler ¶
func NewHandler( userService *user.Service, followingService *corefollowing.Service, noteRepo repository.NoteRepository, idGen id.Generator, noteHider *notehide.Hider, entityPacker *entity.Packer, rolePolicyProvider role.PolicyProvider, metaRepo repository.MetaRepository, ugcVisibilityFn func() string, channelMutingRepo repository.ChannelMutingRepository, mutingRepo repository.MutingRepository, blockingRepo repository.BlockingRepository, relationReader repository.UserRelationReader, ) *Handler
NewHandler creates a new users Handler. followingService, noteRepo, idGen are optional for the bare /show endpoint.
noteHider applies the per-viewer hideNote gate to the notes this handler packs (#3786) and entityPacker is the Packer it packs entities with (#3790). rolePolicyProvider enforces the userListLimit / userEachUserListsLimit role policies on users/lists/create-from-public (#1550); nil skips the limit gate. metaRepo backs /pinned-users and the blocked-host filter. ugcVisibilityFn is a live lookup of meta.ugcVisibilityForVisitor that gates remote profiles for anonymous visitors (#2106 S3); it is read on every request so that changing the setting takes effect without a restart. channelMutingRepo, mutingRepo and blockingRepo back the users/notes mute/block filters and the blocked-by-target check. relationReader fetches the users/show relation block in one statement (#3608); without it the block is read with one query per relation and the response is the same.
func (*Handler) Achievements ¶
Achievements handles POST /api/users/achievements.
func (*Handler) Clips ¶
Clips handles POST /api/users/clips.
非所有者視点では public のみ返す。LIMIT は絞り込み後に適用されるよう SQL 側で WHERE isPublic = true を通す (ListPublicByUser) — 古い post-fetch filter 方式だと private が多いユーザーで空の結果を返してしまう bug になる。
frontend Paginator が cursor mode で投げてくる sinceId / untilId を 拾って repo に渡し、Paginator が次ページ取得で同じ row 集合を返さない ようにする (#487 兄弟ケース)。
func (*Handler) FeaturedNotes ¶
FeaturedNotes handles POST /api/users/featured-notes.
upstream featured-notes.ts は Redis sorted set (getPerUserNotesRanking) で engagement 上位 50 を選抜したあと、Go 側で id DESC に並べ替えて untilId で ページングする 2 段構成。mk-go は SQL ranking + visibility push-down に 置き換えて同じ 2 段で揃える (#1487 Option B / #1491 review):
- selection: `ListFeaturedByUser` が `("renoteCount" + "repliesCount") DESC, id DESC` + visibility push-down + channel 除外 + LIMIT 50 で SQL から プールを取る (post-fetch FilterVisible のページ過少充填と followers 判定 N+1 を回避)。候補は新しい方から 1,000 件に限る (#3612)。
- display: 同 repo 内で id DESC sort → untilId filter → 先頭 limit 件。 id cursor とソート順が一致するので untilId ページングで重複/欠落しない。
- hard mute は packing 前に post-fetch で適用 (visibility と独立な viewer 個別 filter なので SQL push-down 対象外)。
- ミュート・ブロックは本家の isUserRelated と同じ判定 (ミュートは著者を 見ない、#3369)。
func (*Handler) FillDetailedExtras ¶
func (h *Handler) FillDetailedExtras(ctx context.Context, viewer, u *model.User, profile *model.UserProfile, d *entity.UserDetailed)
FillDetailedExtras fills the UserDetailed parts that need the users/show dependencies: movedTo / alsoKnownAs (local lookup only) and pinnedNoteIds / pinnedNotes / pinnedPageId / pinnedPage gated by viewer. It satisfies userpack.DetailExtras so the follow stream / webhook bodies and blocking/create・delete carry the same values as users/show.
func (*Handler) FillDetailedExtrasMany ¶
func (h *Handler) FillDetailedExtrasMany(ctx context.Context, viewer *model.User, targets []userpack.DetailTarget)
FillDetailedExtrasMany fills movedTo / alsoKnownAs, pinnedNoteIds / pinnedNotes and pinnedPageId / pinnedPage for every user of a list response, mirroring upstream UserEntityService.packMany. It satisfies userpack.DetailExtrasMany.
本家 packMany はピン留めを閲覧者がいるときだけ IN でまとめて引き、匿名の 閲覧者には空で返す (pinNotes が空の Map のまま pack に渡る)。ピン留めの ページと移行先は利用者ごとに解決する。mk-go はピン留めのノートとページを まとめて引き、利用者の数に比例して問い合わせが増えないようにする。
func (*Handler) Flashs ¶
Flashs handles POST /api/users/flashs.
frontend Paginator (cursor mode) は untilId / sinceId を forward する (#493)。
func (*Handler) GalleryPosts ¶
GalleryPosts handles POST /api/users/gallery/posts.
frontend Paginator (cursor mode) は untilId / sinceId を forward する (#493)。
func (*Handler) GetFollowingUsersByBirthday ¶
GetFollowingUsersByBirthday handles POST /api/users/get-following-users-by-birthday.
認証ユーザーの followee のうち誕生日 (月日) が指定範囲に入る者を返す。 単発指定 ({month, day}) と範囲指定 ({begin, end}) の 2 形式に対応し、 範囲指定で begin > end の場合は年跨ぎ (例: 12/25..1/5) として扱う。
func (*Handler) GetFrequentlyRepliedUsers ¶
GetFrequentlyRepliedUsers handles POST /api/users/get-frequently-replied-users.
指定 userId が最近返信している相手上位 limit 件を weight = count / peak (最大件数で正規化) 付きで返す。Misskey 本家と同じレスポンス shape。
reply 集計は visibility push-down で viewer が CanSeeNote で見られる reply のみに絞る (#1486)。匿名 viewer は public/home のみ集計する。
func (*Handler) List ¶
List serves the public user directory.
POST /api/users
**DB から読めなくても 200 で空配列を返す。** upstream の explore ページは 配列前提で `.map()` するので、ここで 500 にするとページ全体が開かなくなる。 引数の不正は本家と同じく 400 INVALID_PARAM にする (#3330)。
func (*Handler) ListsCreateFromPublic ¶
ListsCreateFromPublic handles POST /api/users/lists/create-from-public.
公開済みの UserList (listId) から名前を引き継いだ新しい list (name) を作り、 元 list のメンバーをコピーする。upstream create-from-public.ts に合わせて userListLimit gate (TOO_MANY_USERLISTS)、各メンバーで getUser (NO_SUCH_USER) / blocking (YOU_HAVE_BEEN_BLOCKED) / 既存 (ALREADY_ADDED) / member 上限 (TOO_MANY_USERS) を検証し、最初の失敗で中断・エラーを返す (#1550)。
func (*Handler) ListsFavorite ¶
ListsFavorite handles POST /api/users/lists/favorite.
func (*Handler) ListsGetMemberships ¶
ListsGetMemberships handles POST /api/users/lists/get-memberships.
upstream get-memberships.ts: listId(required) の membership 配列 [{id, createdAt, userId, user(UserLite), withReplies}] を返す (requireCredential:false の public endpoint)。可視性は forPublic=false かつ 認証済なら own list のみ、それ以外は public list のみ (#1550)。
func (*Handler) ListsUnfavorite ¶
ListsUnfavorite handles POST /api/users/lists/unfavorite.
func (*Handler) ListsUpdate ¶
ListsUpdate handles POST /api/users/lists/update.
func (*Handler) ListsUpdateMembership ¶
ListsUpdateMembership handles POST /api/users/lists/update-membership.
func (*Handler) OnlineCount ¶
OnlineCount returns the number of locally active users.
GET|POST /api/get-online-users-count
**両メソッドを受ける** (router 側で登録)。frontend は `misskeyApiGet` で GET 呼び出しするので、POST だけだと catchall に落ちて `count` が undefined になり、 admin overview が「NaN 人」を表示していた (#421)。
数えられなければ 0 を返す。ここで 500 にすると overview 全体が開かなくなる。
func (*Handler) Pages ¶
Pages handles POST /api/users/pages.
frontend Paginator (cursor mode) は untilId / sinceId を forward する (#493)。 upstream PageEntityService.pack 同様 `user` (UserLite) を含む full Page entity shape で返す (#1134)。旧 inline map 6 field では frontend MkPagePreview の `page.user.username` template が落ちて list が空になる drop-in regression を起こしていた。
func (*Handler) PinnedUsers ¶
PinnedUsers serves the instance's featured accounts.
POST /api/pinned-users
引けない acct は**黙って飛ばす**。`meta.pinnedUsers` は管理者が手で書く 文字列で、typo や退会済みの指定が混ざりうる。1 件のせいで全体が空になる ほうが困る。
func (*Handler) Reactions ¶
Reactions handles POST /api/users/reactions.
upstream Misskey TS の users/reactions と同 semantics:
- target user の publicReactions が false で viewer ≠ target なら 403 REACTIONS_NOT_PUBLIC (= reaction history は private)。
- target user が remote なら 400 IS_REMOTE_USER (mk-go では現状 local のみ対応、upstream と同じ制限)。
- それ以外 (public か self view) なら reactor の reaction list を id / createdAt / type / user / note shape で返す。
note は upstream の packManyWithNote 相当の完全 shape (PackNotes) で返す。 最小 shape (id / userId / text) だと createdAt / visibility / user 等が 欠落し、misskey_dart の Note.fromJson が非null cast に失敗して落ちる (#1227、当初は #821 PR-D で最小 shape start としていた)。
func (*Handler) Relation ¶
Relation handles POST /api/users/relation. upstream Misskey TS `users/relation.ts` (= getRelation in server/api/common/getRelation.ts) と同 semantics で viewer と target の follow / follow-request / block / mute / renote-mute の関係性を返す。
認証はルートの登録 (internal/server の routes_users.go) の `middleware.RequireAuth()` で前段強制されているため production では viewer == nil は到達不可。下の `viewer == nil` branch は defensive guard + 単体テスト用 (= handler を直接叩く test path)。
repo が wired されていない (= legacy handler test) では該当 field を false に保つので production runtime には影響しない (router で必ず wired される)。
func (*Handler) ReportAbuse ¶
ReportAbuse handles POST /api/users/report-abuse.
func (*Handler) SearchByUsernameAndHost ¶
SearchByUsernameAndHost handles POST /api/users/search-by-username-and-host.
func (*Handler) SetAbuseRepo ¶
func (h *Handler) SetAbuseRepo(r repository.AbuseReportRepository)
SetAbuseRepo attaches the abuse report repository.
func (*Handler) SetAbuseReportCreatedNotifier ¶
func (h *Handler) SetAbuseReportCreatedNotifier(n AbuseReportCreatedNotifier)
SetAbuseReportCreatedNotifier wires the notifications for new reports. nil なら通知しない (= test)。
func (*Handler) SetChartHook ¶
SetChartHook attaches a ChartHook invoked after Show successfully resolves a profile.
func (*Handler) SetClipFavoriteRepo ¶
func (h *Handler) SetClipFavoriteRepo(r repository.ClipFavoriteRepository)
SetClipFavoriteRepo attaches a ClipFavoriteRepository so users/clips can resolve favoritedCount / isFavorited (#1562).
func (*Handler) SetClipNoteRepo ¶
func (h *Handler) SetClipNoteRepo(r repository.ClipNoteRepository)
SetClipNoteRepo attaches a ClipNoteRepository so users/clips can report notesCount for the owner (#2243).
func (*Handler) SetClipRepo ¶
func (h *Handler) SetClipRepo(r repository.ClipRepository)
SetClipRepo attaches a ClipRepository for users/clips.
func (*Handler) SetDriveFileRepo ¶
func (h *Handler) SetDriveFileRepo(r repository.DriveFileRepository)
SetDriveFileRepo wires the drive file repo used by users/pages to resolve a page's attachedFiles / eyeCatchingImage (#1662)。
func (*Handler) SetEmojiRepo ¶
func (h *Handler) SetEmojiRepo(r repository.EmojiRepository)
SetEmojiRepo attaches an EmojiRepository for custom emoji resolution.
func (*Handler) SetFeaturedRanking ¶
func (h *Handler) SetFeaturedRanking(r FeaturedRankingReader)
SetFeaturedRanking wires the per-user engagement ranking reader (#1687). nil 注入時は SQL count-DESC fallback。
func (*Handler) SetFlashRepo ¶
func (h *Handler) SetFlashRepo(r repository.FlashRepository)
SetFlashRepo attaches a FlashRepository for users/flashs.
func (*Handler) SetFollowRequestRepo ¶
func (h *Handler) SetFollowRequestRepo(r repository.FollowRequestRepository)
SetFollowRequestRepo attaches a FollowRequestRepository for pending request queries.
func (*Handler) SetFollowingRepo ¶
func (h *Handler) SetFollowingRepo(r repository.FollowingRepository)
SetFollowingRepo attaches a FollowingRepository for follow relation queries.
func (*Handler) SetGalleryRepo ¶
func (h *Handler) SetGalleryRepo(r repository.GalleryRepository)
SetGalleryRepo attaches a GalleryRepository for users/gallery/posts.
func (*Handler) SetInstanceRepo ¶
func (h *Handler) SetInstanceRepo(r repository.InstanceRepository)
SetInstanceRepo attaches an InstanceRepository for remote user instance info.
func (*Handler) SetLocalHost ¶
SetLocalHost records the instance hostname used to resolve `@user@host` entries in `meta.pinnedUsers`.
空でも動く — その場合 `@user@own.example` 形式の指定が remote 扱いになり 引けなくなるだけで、`@user` 形式は従来どおり解決する。
func (*Handler) SetMemoRepo ¶
func (h *Handler) SetMemoRepo(r repository.UserMemoRepository)
SetMemoRepo attaches a UserMemoRepository for users/update-memo.
func (*Handler) SetModeratorChecker ¶
func (h *Handler) SetModeratorChecker(m ModeratorChecker)
SetModeratorChecker wires the moderator check used by users/reactions so a moderator/admin viewer can see any user's reactions (incl. remote), matching upstream's `if (!iAmModerator) { ...isRemoteUser/publicReactions checks }`. nil keeps the gate strict (= test fixture / unwired)。
func (*Handler) SetNoteFieldResolver ¶
func (h *Handler) SetNoteFieldResolver(r *entity.NoteFieldResolver)
SetNoteFieldResolver wires the shared resolver that fills Files / MyReaction / Channel on packed notes including embedded Renote / Reply (#426)。
func (*Handler) SetNoteReactionRepo ¶
func (h *Handler) SetNoteReactionRepo(r repository.NoteReactionRepository)
SetNoteReactionRepo wires the NoteReactionRepository for users/reactions (= reactor 視点の reaction list、#821 PR-D)。
func (*Handler) SetPageRepo ¶
func (h *Handler) SetPageRepo(r repository.PageRepository)
SetPageRepo attaches a PageRepository for users/pages.
func (*Handler) SetPiningRepo ¶
func (h *Handler) SetPiningRepo(r repository.UserNotePiningRepository)
SetPiningRepo wires the user_note_pining repository used to fill pinnedNoteIds / pinnedNotes on /api/users/show.
func (*Handler) SetProxyFollow ¶
func (h *Handler) SetProxyFollow(p ProxyFollowEnqueuer)
SetProxyFollow wires the proxy-follow enqueuer used by create-from-public when remote users are copied into the new list (#1704). nil 時は skip。
func (*Handler) SetReactionReader ¶
func (h *Handler) SetReactionReader(r entity.BufferedReactionsReader)
SetReactionReader wires a BufferedReactionsReader so PackNote / PackNotes can merge in-flight buffered reaction deltas (#647)。
func (*Handler) SetRelationCache ¶
func (h *Handler) SetRelationCache(rc *repository.RelationCache)
SetRelationCache wires the per-user relation cache used by the mute / block filter (#3607). nil keeps reading the repositories.
func (*Handler) SetRemoteStatsFetcher ¶
func (h *Handler) SetRemoteStatsFetcher(f RemoteStatsFetcher)
SetRemoteStatsFetcher wires the remote stats fetcher (#943).
func (*Handler) SetRenoteMutingRepo ¶
func (h *Handler) SetRenoteMutingRepo(r repository.RenoteMutingRepository)
SetRenoteMutingRepo attaches a RenoteMutingRepository for renote mute status queries.
func (*Handler) SetSelfPacker ¶
SetSelfPacker wires the Packer that promotes the viewer's own entry into MeDetailed. Unset promotes without the handler-only fields.
func (*Handler) SetServerURL ¶
SetServerURL records the canonical instance URL used to recognize local ActivityPub actor URIs.
func (*Handler) SetUGCVisibility ¶
SetUGCVisibility sets the meta.ugcVisibilityForVisitor policy used to hide remote user profiles from anonymous visitors when set to "local" (#2106 S3).
func (*Handler) SetUserListEventPublisher ¶
func (h *Handler) SetUserListEventPublisher(p UserListMembershipEventPublisher)
SetUserListEventPublisher wires the userListStream publisher used to live-update connected userList channels when update-membership changes withReplies (#2051)。
func (*Handler) SetUserListFavoriteRepo ¶
func (h *Handler) SetUserListFavoriteRepo(r UserListFavoriteRepository)
SetUserListFavoriteRepo attaches a UserListFavoriteRepository.
func (*Handler) SetUserListRepo ¶
func (h *Handler) SetUserListRepo(r repository.UserListRepository)
SetUserListRepo attaches a UserListRepository for list update endpoints.
func (*Handler) SetUserRepo ¶
func (h *Handler) SetUserRepo(r repository.UserRepository)
func (*Handler) Show ¶
Show handles POST /api/users/show. TS互換: userIds (配列) が渡された場合は UserDetailed の配列を返す (#1547)。 userId / username が渡された場合は単体 UserDetailed を返す。
func (*Handler) UpdateMemo ¶
UpdateMemo handles POST /api/users/update-memo. memo が null / 空文字なら削除、それ以外なら upsert する。
func (*Handler) UserRecommendation ¶
UserRecommendation handles POST /api/users/recommendation.
認証ユーザーがまだフォローしていないローカルのアクティブユーザーを followersCount 降順で返す (onboarding 向け)。Misskey 本家互換で 7 日以内に 更新があったユーザーに絞る。
type ModeratorChecker ¶
type ModeratorChecker interface {
IsModerator(userID string) bool
IsAdministrator(userID string) bool
}
ModeratorChecker reports whether a user holds moderator / administrator privileges. core/role.Service implements it. Narrowing to this interface avoids importing core/role into the handler.
type NotesRequest ¶
type NotesRequest struct {
UserID string `json:"userId"`
Limit *jsnum.Int `json:"limit"`
SinceID string `json:"sinceId"`
UntilID string `json:"untilId"`
SinceDate *jsnum.Int `json:"sinceDate"`
UntilDate *jsnum.Int `json:"untilDate"`
WithFiles *bool `json:"withFiles"`
WithReplies *bool `json:"withReplies"`
WithRenotes *bool `json:"withRenotes"`
WithChannelNotes *bool `json:"withChannelNotes"`
// AllowPartial は upstream notes.ts:67 の fanout TL hint。mk-go は fanout TL
// を持たないため挙動には影響しないが、param を受理して 400 を出さないために
// 受ける (#1547)。
AllowPartial *bool `json:"allowPartial"`
}
NotesRequest is the request body for users/notes. withFiles / withReplies / withRenotes / withChannelNotes は upstream の paramDef と同じ optional boolean。pointer で受けることで JSON 上の "未指定" を upstream paramDef のデフォルトに置き換える経路を確保する (#1021)。
type ProxyFollowEnqueuer ¶
type ProxyFollowEnqueuer interface {
EnqueueProxyFollow(remoteUserIDs []string)
}
ProxyFollowEnqueuer makes the proxy account follow remote users added to a list (#1704)。実装は core/userlist.ProxyFollower。
type RemoteStatsFetcher ¶
type RemoteStatsFetcher interface {
Fetch(ctx context.Context, host, username string) *RemoteUserStatsView
}
RemoteStatsFetcher abstracts the federation.RemoteStatsFetcher so wiring is nil-tolerant (= test handler doesn't need a real federation package).
type RemoteUserStatsView ¶
RemoteUserStatsView mirrors federation.RemoteUserStats. 同型を package に import せず interface 経由で渡せるようにするための view 構造体。
type SearchRequest ¶
type SearchRequest struct {
Query string `json:"query"`
Limit *jsnum.Int `json:"limit"`
// Origin は upstream Misskey TS と同じ enum: "local" / "remote" /
// "combined" (default)。空 / 不明値は "combined" 扱い (#763)。
Origin string `json:"origin"`
Offset jsnum.Int `json:"offset"`
// Detail は upstream search.ts:38 と同じく default true。false のとき
// UserLite を返す (#1547)。
Detail *bool `json:"detail"`
}
SearchRequest is the request body for users/search.
type ShowRequest ¶
type ShowRequest struct {
UserID *string `json:"userId"`
UserIDs []string `json:"userIds"`
Username *string `json:"username"`
Host *string `json:"host"`
}
ShowRequest is the request body for users/show.
type UserListFavoriteRepository ¶
type UserListFavoriteRepository interface {
Create(fav *model.UserListFavorite) error
Delete(userID, listID string) error
ListByUser(userID string) ([]*model.UserListFavorite, error)
Exists(userID, listID string) (bool, error)
}
UserListFavoriteRepository is the interface for user list favorite operations.
type UserListMembershipEventPublisher ¶
type UserListMembershipEventPublisher interface {
PublishUserListEvent(listID, eventType string, body any)
}
SetUserRepo wires a UserRepository so users/notes filters out notes that match the viewer's hardMutedWords (#787) and so users/reactions can run the IS_REMOTE_USER / REACTIONS_NOT_PUBLIC access control (#821 PR-D). 本番では必ず wire される (internal/server の wiring_accounts.go で、組み立てのときに呼ばれる)。 unwired の場合 users/reactions は access control を skip して noteReactionRepo の有無に応じて空配列か list を返す test 互換 path に 落ちる (= production 影響なし、test 用 fall-through)。 UserListMembershipEventPublisher publishes membership events (here: userUpdated for a withReplies change) to userListStream:{listId} (#2051)。