Skip to content

feat: お知らせボットを登録時に自動でフォローさせ、解除とブロックを拒む (#467 / #468) - #469

Merged
pooza merged 3 commits into
daisskeyfrom
feature/467-468-autofollow
Nov 19, 2026
Merged

pooza merged 3 commits into
daisskeyfrom
feature/467-468-autofollow

Conversation

@pooza

@pooza pooza commented Nov 19, 2026

Copy link
Copy Markdown
Owner

What

Fix #467
Fix #468

Why

プリセットのサーバーの規約は、お知らせボットのフォローを外すことを認めていない。Mastodon の 3 台は招待リンクの自動フォローで登録時にフォローさせられるが、Misskey には当たる機能が無い。上流の misskey-dev#12451 には頼らず、フォークで持つ(2026-11-19 の判断。解除は拒む方向で決着済み)。

Additional info (optional)

  • 解除の拒否は UserFollowingService.unfollow にまとめた。対象は「フォローしている側がローカルで、フォローされている側が指定したアカウント」だけ。リモートからの Undo Follow などは通る
  • 既存の利用者への適用は、管理者が「既存の利用者にもフォローさせる」(admin/auto-follow/apply)を一度だけ実行する。設定の保存だけでは走らない。二重にジョブが積まれないよう、1 分に 1 回まで
  • 指定できるのはこのサーバーのアカウントだけ(リモートの acct は無視する)
  • ⚠ info は上流の既定の予約ユーザー名なので、新しいサーバーでは登録できない(ダイスキーの @info は既存なので影響なし)
  • 上流で デフォルトで特定のユーザーをフォローする misskey-dev/misskey#12451 が実装されたら、こちらを捨てて上流の設定へ移す

検証

  • 新規 e2e test/e2e/auto-follow.ts 11 件 PASS(登録時の自動フォロー・解除とブロックの拒否・一括適用・ボット側の操作・設定を外したあとの解除)
  • 既存 e2e block.ts / move.ts / endpoints.ts 160 件 PASS
  • backend tsc --noEmit PASS / frontend vue-tsc は変更ファイルのエラー 0 件
  • pnpm build-misskey-js-with-types で autogen を再生成して同梱
  • check-migrations: migration から作った DB で、meta.autoFollowUsers に関する pending DDL なし(テスト専用チャート表の index だけが出る BASELINE)
  • node scripts/check-shipping.mjs --base origin/daisskey → Lint / SPDX PASS。Locale safety は en-US.yml のフォーク独自キー _autoFollow だけ(AGENTS.md 少メモリ環境への対策 #2 の例外)

Checklist

🤖 Generated with Claude Code

https://claude.ai/code/session_01D3TRPBgyxpbD71cJCPzJr6

pooza and others added 2 commits November 19, 2026 21:10
#344 で UserListService.push の createFollowJob を止めたが、AccountMoveService に
同じ処理(リストの登録を移行先へ引き継いだ直後に、プロキシアカウントが移行先の
リモートユーザーをフォローする)が残っていた。#344 と同じ形でコメントアウトする。

Fix #468

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D3TRPBgyxpbD71cJCPzJr6
コントロールパネルに「自動でフォローさせるユーザー」(meta.autoFollowUsers) を足す。
上流の misskey-dev#12451 に当たる機能をフォークで持つ。

- 新しく登録した利用者に、指定したアカウントをフォローさせる (SignupService)
- ローカルの利用者が指定したアカウントへのフォローを外すことを拒む。
  UserFollowingService.unfollow でまとめて止め、following/delete は
  403 CANNOT_UNFOLLOW_AUTO_FOLLOW_USER を返す。一括解除・インポート・凍結時の
  解除ジョブはその 1 件だけ飛ばす
- 指定したアカウントのブロックも拒む (403 CANNOT_BLOCK_AUTO_FOLLOW_USER)。
  ブロックするとフォローが外れ、ブロックしたのにフォローが残る矛盾も作らないため
- 指定したアカウント自身がフォロワーを外す操作・利用者をブロックする操作は通す
- 既存の利用者へ一括でフォローさせる管理操作 admin/auto-follow/apply を足す。
  設定の保存だけでは走らせない

Fix #467

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D3TRPBgyxpbD71cJCPzJr6
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-19T12:13:21.950539Z 0afbcd1 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0afbcd166e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +115 to +118
await this.queueService.createFollowJob(followers.slice(i, i + 1000).map(follower => ({
from: { id: follower.id },
to: { id: followee.id },
})));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reconcile existing outgoing blocks before applying follows

If an existing local user blocked the designated bot before it was added to this setting, this operation queues a follow without removing that block. UserFollowingService.follow() explicitly rejects local follows when checkBlocked(follower.id, followee.id) is true, and RelationshipProcessorService.processFollow() does not reconcile the block, so the job fails and the user remains outside the mandatory follow relationship even after repeated applications. Handle pre-existing user-to-bot blocks when applying the policy, while preserving blocks initiated by the bot.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

9082c16 で修正しました。一括適用の前に、利用者からボットへのブロックを外します。ボットからのブロックは管理者の判断なので残し、その利用者は対象から外します。e2e に両方のケースを足しています。

}

// フォーク独自 (pooza/misskey#467): 指定したアカウントを自動でフォローさせる
await this.autoFollowService.followOnSignup(account);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Prevent follow-queue failures from aborting completed signups

When auto-follow is configured and enqueueing fails, this awaited call rejects after the account transaction has already committed. SignupApiService.signupPending() consequently exits before copying the verified email into the profile, consuming the pending registration, or signing the user in; retrying the verification link then fails because the username already exists. The non-email signup path likewise reports failure for an account that was actually created. Make follow scheduling recoverable without aborting the remaining signup finalization.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

9082c16 で修正しました。登録時のフォローのジョブ投入に失敗しても、ログに残すだけで例外は投げません(登録の後始末を止めない)。漏れた分は一括適用で拾えます。

Codex の P2 指摘 2 件への対応。

- 一括適用の前から利用者がボットをブロックしていると、フォローのジョブが
  失敗し続けていた。利用者からボットへのブロックは外してからフォローさせる。
  ボットからのブロックは管理者の判断なので残し、その利用者は対象から外す
- 登録時のフォローのジョブ投入に失敗すると、アカウントの作成後に例外が出て
  メール認証の後始末やサインインが飛んでいた。失敗はログに残すだけにする

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D3TRPBgyxpbD71cJCPzJr6
@pooza
pooza merged commit d8dfeed into daisskey Nov 19, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant