Documentation
¶
Index ¶
- type ChatInvitationNotifier
- type Handler
- func (h *Handler) AttachedChatMessages(c *echo.Context) error
- func (h *Handler) History(c *echo.Context) error
- func (h *Handler) InvitationsAccept(c *echo.Context) error
- func (h *Handler) InvitationsCreate(c *echo.Context) error
- func (h *Handler) InvitationsDelete(c *echo.Context) error
- func (h *Handler) InvitationsIgnore(c *echo.Context) error
- func (h *Handler) InvitationsInbox(c *echo.Context) error
- func (h *Handler) InvitationsOutbox(c *echo.Context) error
- func (h *Handler) InvitationsReject(c *echo.Context) error
- func (h *Handler) MembersBan(c *echo.Context) error
- func (h *Handler) MembersUpdateMembership(c *echo.Context) error
- func (h *Handler) Messages(c *echo.Context) error
- func (h *Handler) MessagesCreate(c *echo.Context) error
- func (h *Handler) MessagesCreateToRoom(c *echo.Context) error
- func (h *Handler) MessagesCreateToUser(c *echo.Context) error
- func (h *Handler) MessagesDelete(c *echo.Context) error
- func (h *Handler) MessagesRead(c *echo.Context) error
- func (h *Handler) MessagesSearch(c *echo.Context) error
- func (h *Handler) MessagesShow(c *echo.Context) error
- func (h *Handler) MessagesUpdate(c *echo.Context) error
- func (h *Handler) PackInvitationByID(invitationID, viewerID string) (map[string]any, bool)
- func (h *Handler) ReactionsCreate(c *echo.Context) error
- func (h *Handler) ReactionsDelete(c *echo.Context) error
- func (h *Handler) ReadAll(c *echo.Context) error
- func (h *Handler) RoomTimeline(c *echo.Context) error
- func (h *Handler) RoomsCreate(c *echo.Context) error
- func (h *Handler) RoomsDelete(c *echo.Context) error
- func (h *Handler) RoomsJoin(c *echo.Context) error
- func (h *Handler) RoomsJoined(c *echo.Context) error
- func (h *Handler) RoomsJoining(c *echo.Context) error
- func (h *Handler) RoomsLeave(c *echo.Context) error
- func (h *Handler) RoomsMembers(c *echo.Context) error
- func (h *Handler) RoomsMute(c *echo.Context) error
- func (h *Handler) RoomsOwned(c *echo.Context) error
- func (h *Handler) RoomsShow(c *echo.Context) error
- func (h *Handler) RoomsTransferOwnership(c *echo.Context) error
- func (h *Handler) RoomsUnmute(c *echo.Context) error
- func (h *Handler) RoomsUpdate(c *echo.Context) error
- func (h *Handler) SetChatAvailabilityChecker(c middleware.ChatAvailabilityChecker)
- func (h *Handler) SetInvitationNotifier(n ChatInvitationNotifier)
- func (h *Handler) SetModLog(m ModLogger)
- func (h *Handler) SetModeratorChecker(m ModeratorChecker)
- func (h *Handler) SetService(svc *corechat.Service)
- func (h *Handler) SetUserRepo(r repository.UserRepository)
- func (h *Handler) UnreadCount(c *echo.Context) error
- func (h *Handler) UserTimeline(c *echo.Context) error
- type ModLogger
- type ModeratorChecker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChatInvitationNotifier ¶
type ChatInvitationNotifier interface {
OnChatRoomInvitationReceived(inviteeID, inviterID, invitationID string)
}
ChatInvitationNotifier records a 'chatRoomInvitationReceived' notification on the invitee's stream (#1559)。循環依存を避けるため interface で受け取る (実装は core/notification.Hook)。
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler handles chat/* endpoints.
func NewHandler ¶
func NewHandler(repo repository.ChatRepository, idGen id.Generator, entityPacker *entity.Packer, fileRepo repository.DriveFileRepository, lites userpack.LiteFiller) *Handler
NewHandler creates a new chat handler.
entityPacker is the Packer this Handler packs entities with (#3794). fileRepo is the drive file repository for attached-chat-messages and the owner check of the attached file (#1218, #2708). lites is the batch resolver of instance / emojis for the UserLite values embedded in chat responses (#3438).
どれも無いと黙って劣化する (メディアの URL が生のまま / 他人の drive ファイルを 添付できる / リモートの利用者に instance と絵文字が載らない) ので、構築子の必須の 引数で受ける (#3823)。
func (*Handler) AttachedChatMessages ¶
AttachedChatMessages handles POST /api/drive/files/attached-chat-messages. 指定 drive file を添付した chat message を id cursor で返す。並び順は repository の paginationOrder に従うので、sinceId 単独指定のページだけは 古い順になる (#2713)。 upstream (read:drive) と同じく file は owner-scope で引く (moderator は任意 file 可)。 連合互換: res は ChatMessage の配列 (packMessageDetailed)。
func (*Handler) History ¶
History handles POST /api/chat/history.
upstream `chat/history` は `room: bool` parameter を取り、true の時は chat ルーム内の最新メッセージ、false (デフォルト) の時は 1-on-1 DM の 最新メッセージを返す。FE の MkChatHistories.vue は両方を並行に呼んで マージするため、room パラメータを正しくハンドリングしないと chat home で何も描画されない (#692)。
func (*Handler) InvitationsAccept ¶
InvitationsAccept handles POST /api/chat/rooms/invitations/accept.
func (*Handler) InvitationsCreate ¶
InvitationsCreate handles POST /api/chat/rooms/invitations/create.
func (*Handler) InvitationsDelete ¶
InvitationsDelete handles POST /api/chat/rooms/invitations/delete. ルームオーナーが自分の送った招待を取り消す。
招待された側は reject / ignore を使う。こちらは連合の Reject を送らないので、 被招待者に開放すると remote room の招待を黙って消せてしまう。
func (*Handler) InvitationsIgnore ¶
InvitationsIgnore handles POST /api/chat/rooms/invitations/ignore.
func (*Handler) InvitationsInbox ¶
InvitationsInbox handles POST /api/chat/rooms/invitations/inbox.
func (*Handler) InvitationsOutbox ¶
InvitationsOutbox handles POST /api/chat/rooms/invitations/outbox.
func (*Handler) InvitationsReject ¶
InvitationsReject handles POST /api/chat/rooms/invitations/reject.
func (*Handler) MembersBan ¶
MembersBan handles POST /api/chat/rooms/members/ban. ルームオーナーのみが他メンバーを退出させられる。
func (*Handler) MembersUpdateMembership ¶
MembersUpdateMembership handles POST /api/chat/rooms/members/update-membership. ルームオーナーのみが他メンバーの設定を変更できる。
func (*Handler) MessagesCreate ¶
MessagesCreate handles POST /api/chat/messages/create. service が wire されていれば streaming 配信も同時に行う。
func (*Handler) MessagesCreateToRoom ¶
MessagesCreateToRoom handles POST /api/chat/messages/create-to-room.
func (*Handler) MessagesCreateToUser ¶
MessagesCreateToUser handles POST /api/chat/messages/create-to-user.
func (*Handler) MessagesDelete ¶
MessagesDelete handles POST /api/chat/messages/delete.
func (*Handler) MessagesRead ¶
MessagesRead handles POST /api/chat/messages/read.
func (*Handler) MessagesSearch ¶
MessagesSearch handles POST /api/chat/messages/search.
func (*Handler) MessagesShow ¶
MessagesShow handles POST /api/chat/messages/show.
func (*Handler) MessagesUpdate ¶
MessagesUpdate handles POST /api/chat/messages/update.
func (*Handler) PackInvitationByID ¶
PackInvitationByID loads an invitation by ID (with room + invitee user) and packs it for the given viewer, returning false when it no longer exists. Used as the read-time lookup for chatRoomInvitationReceived notifications (#1559)。
func (*Handler) ReactionsCreate ¶
ReactionsCreate handles POST /api/chat/messages/reactions/create and POST /api/chat/messages/react. Reaction format: "userId/emoji".
func (*Handler) ReactionsDelete ¶
ReactionsDelete handles POST /api/chat/messages/reactions/delete and POST /api/chat/messages/unreact.
func (*Handler) RoomTimeline ¶
RoomTimeline handles POST /api/chat/messages/room-timeline.
upstream の readRoomChatMessage 相当 (#692)。
func (*Handler) RoomsCreate ¶
RoomsCreate handles POST /api/chat/rooms/create.
func (*Handler) RoomsDelete ¶
RoomsDelete handles POST /api/chat/rooms/delete.
func (*Handler) RoomsJoined ¶
RoomsJoined handles POST /api/chat/rooms/joined.
func (*Handler) RoomsJoining ¶
RoomsJoining handles POST /api/chat/rooms/joining.
upstream joining.ts は ChatRoomMembership[] (populateRoom:true, populateUser:false) を返す。旧 mk-go は RoomsJoined (= ChatRoom[]) の alias だったが、shape が異なるため membership を返すよう独立実装する。
func (*Handler) RoomsLeave ¶
RoomsLeave handles POST /api/chat/rooms/leave.
func (*Handler) RoomsMembers ¶
RoomsMembers handles POST /api/chat/rooms/members.
func (*Handler) RoomsOwned ¶
RoomsOwned handles POST /api/chat/rooms/owned.
func (*Handler) RoomsShow ¶
RoomsShow handles POST /api/chat/rooms/show.
upstream Misskey TS 2026.5.4 (`hasPermissionToViewRoomInfo`) と互換するため、 owner / member / 招待受信者 / moderator 以外は noSuchRoom (404) を返す (#1164 Phase C)。旧 mk-go は room id を知っていれば誰でも room メタ情報を 取得できる drop-in regression 状態だったため本 gate で塞ぐ。
func (*Handler) RoomsTransferOwnership ¶
RoomsTransferOwnership handles POST /api/chat/rooms/transfer-ownership.
func (*Handler) RoomsUnmute ¶
RoomsUnmute handles POST /api/chat/rooms/unmute.
func (*Handler) RoomsUpdate ¶
RoomsUpdate handles POST /api/chat/rooms/update.
func (*Handler) SetChatAvailabilityChecker ¶
func (h *Handler) SetChatAvailabilityChecker(c middleware.ChatAvailabilityChecker)
SetChatAvailabilityChecker wires the role-policy provider used to verify a recipient's chatAvailability(write) in create-to-user (#1796). nil skips it.
func (*Handler) SetInvitationNotifier ¶
func (h *Handler) SetInvitationNotifier(n ChatInvitationNotifier)
SetInvitationNotifier wires the notifier used by invitations/create to send a 'chatRoomInvitationReceived' notification (upstream ChatService の招待作成)。
func (*Handler) SetModLog ¶
SetModLog wires the moderation-log writer used when a moderator deletes another user's chat room (#1541)。
func (*Handler) SetModeratorChecker ¶
func (h *Handler) SetModeratorChecker(m ModeratorChecker)
SetModeratorChecker wires a moderator checker for attached-chat-messages.
func (*Handler) SetService ¶
SetService wires a chat Service so that state-changing message endpoints (create/update/delete/read) route through it and publish streaming events. 未設定の場合は従来どおり repo 直操作にフォールバックする (既存テスト互換)。
func (*Handler) SetUserRepo ¶
func (h *Handler) SetUserRepo(r repository.UserRepository)
SetUserRepo wires the user repository for resolving invitee UserLite in the invitations/create response.
func (*Handler) UnreadCount ¶
UnreadCount handles POST /api/chat/unread-count.
func (*Handler) UserTimeline ¶
UserTimeline handles POST /api/chat/messages/user-timeline.
upstream の readUserChatMessage 相当: チャット画面を開いた瞬間に「相手 → 自分」の DM をすべて既読としてマークする。FE は新着メッセージにしか 'read' イベントを送らないので、initial load 時点の既読化はサーバ側で やらないと unread badge がリロードのたびに復活する (#692)。
type ModLogger ¶
type ModLogger interface {
Log(ctx context.Context, moderatorID string, t moderationlog.LogType, info map[string]any)
}
ModLogger records a moderation action. Satisfied by *core/moderationlog.Service. nil 配線時は記録を skip する (#1541)。
type ModeratorChecker ¶
ModeratorChecker reports whether a user has moderator privileges. Implemented by core/role.Service. Used to widen attached-chat-messages from owner-only to any file for moderators (upstream `userId: isModerator ? undefined : me.id`).