✨ Add user block/mute domain foundation and REST API - #17
Merged
Conversation
Add Block and Mute relationship support following the existing pure-CRUD
Follow pattern across all layers:
- Migration: blocks/mutes tables with local/remote exclusive CHECK
constraints, FK CASCADE, and partial unique indexes per direction
- kernel: Block/Mute entities (rejecting remote-to-remote) and
BlockRepository/MuteRepository traits
- driver: Postgres implementations with duplicate detection (23505)
- application: block/unblock/get_blocks and mute/unmute/get_mutes use
cases with local-nanoid/remote-actor target resolution; blocking an
account removes follow relationships in both directions
- server: authenticated REST endpoints under
/api/v1/accounts/{account_id}/{block,unblock,blocks,mute,unmute,mutes}
with OpenAPI registration
ActivityPub federation of Block activities is out of scope and will be
handled in a follow-up issue (block-mute-federation).
turtton
added a commit
that referenced
this pull request
Jul 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Close #16
ユーザーブロック/ミュート機能のドメイン基盤と REST API を実装。既存 Follow の純粋 CRUD Repository パターンに倣い、エンティティ・Repository・ユースケース・エンドポイントを新設。ブロック成立時の双方向フォロー解除までをローカルで完結させる。ActivityPub 連合(Block アクティビティの配送/受信)は後続 issue (block-mute-federation) で扱う。
Changes
20260722000001_add_blocks_and_mutes.sql:blocks/mutesテーブル(local/remote 排他 CHECK、FK ON DELETE CASCADE、4 方向の部分ユニークインデックス)Block/Muteエンティティ(Remote→Remote はドメインルールで拒否)、BlockRepository/MuteRepositorytrait、テストビルダーKernelError::Rejected、存在しない削除はNotFoundremote_actorヘルパーをpub(crate)に widening して再利用)remove_follows_betweenで双方向のフォロー関係を解除account_signパーミッション/api/v1/accounts/{account_id}/配下)/accounts/{account_id}/block/accounts/{account_id}/unblock/accounts/{account_id}/blocks/accounts/{account_id}/mute/accounts/{account_id}/unmute/accounts/{account_id}/mutesTest plan
cargo test --workspace全パス(実 DB: 257 passed / 0 failed)cargo fmt --check/git diff --checkパス🤖 Generated with OhMyOpenCode