Skip to content

enhance: Add canCreateChannel role policy#17121

Open
Copilot wants to merge 9 commits intodevelopfrom
copilot/add-channel-creation-role-policy
Open

enhance: Add canCreateChannel role policy#17121
Copilot wants to merge 9 commits intodevelopfrom
copilot/add-channel-creation-role-policy

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 22, 2026

What

Adds canCreateChannel role policy to control channel creation permissions via roles.

Changes:

  • Added canCreateChannel boolean policy to RolePolicies type and defaults
  • Enforced via requiredRolePolicy on /channels/create endpoint
  • Added to role JSON schema and misskey-js constants
  • Added frontend UI for policy configuration in admin role settings
  • Localized in en-US and ja-JP

Default: true (backward compatible - existing users retain channel creation access)

Why

Enables moderators to restrict channel creation as a moderation tool, as requested in the issue.

Additional info (optional)

Policy follows existing can* permission patterns (OR aggregation - any role with true grants access). Returns ROLE_PERMISSION_DENIED when denied.

Frontend UI includes:

  • Base role settings page: Toggle for canCreateChannel policy
  • Role editor page: Full configuration with "Use Base Value", enable/disable toggle, and priority selection (Low/Middle/High)

Checklist

  • Read the contribution guide
  • Test working in a local environment
  • (If needed) Update CHANGELOG.md
  • (If possible) Add tests
Original prompt

This section details on the original issue you should resolve

<issue_title>チャンネルを作成できるか否かをロールで制御できるようにする</issue_title>
<issue_description>### Summary

チャンネルを作成できるか否かを制御するロールポリシーを追加する(canCreateChannel)

Purpose

モデレーション

Do you want to implement this feature yourself?

  • Yes, I will implement this by myself and send a pull request</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 4 commits January 22, 2026 12:17
Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
Copilot AI changed the title [WIP] Add role policy to control channel creation permissions Add canCreateChannel role policy Jan 22, 2026
Copilot AI requested a review from syuilo January 22, 2026 12:27
@github-actions github-actions bot added packages/backend Server side specific issue/PR packages/misskey-js labels Jan 22, 2026
@syuilo
Copy link
Copy Markdown
Member

syuilo commented Jan 22, 2026

@copilot canCreateChannelポリシーの設定を行うフロントエンド側の実装が抜けているようです

@codecov
Copy link
Copy Markdown

codecov bot commented Jan 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.68%. Comparing base (a18c909) to head (4d2b8f4).
⚠️ Report is 27 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #17121      +/-   ##
===========================================
+ Coverage    63.65%   63.68%   +0.02%     
===========================================
  Files         1161     1164       +3     
  Lines       116313   116749     +436     
  Branches      8407     8499      +92     
===========================================
+ Hits         74042    74354     +312     
- Misses       40063    40209     +146     
+ Partials      2208     2186      -22     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jan 22, 2026

@copilot canCreateChannelポリシーの設定を行うフロントエンド側の実装が抜けているようです

Added frontend UI configuration in commit cd767b2. The canCreateChannel policy can now be configured in:

  • Base role settings (admin/roles)
  • Individual role editor (admin/roles/edit)

Both include the standard policy controls (enable/disable toggle, priority settings, and "Use Base Value" option).

@github-actions github-actions bot added the packages/frontend Client side specific issue/PR label Jan 22, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 23, 2026

このPRによるapi.jsonの差分

差分はこちら
--- base
+++ head
@@ -92888,6 +92888,9 @@
           "canHideAds": {
             "type": "boolean"
           },
+          "canCreateChannel": {
+            "type": "boolean"
+          },
           "driveCapacityMb": {
             "type": "integer"
           },
@@ -92984,6 +92987,7 @@
           "canSearchUsers",
           "canUseTranslator",
           "canHideAds",
+          "canCreateChannel",
           "driveCapacityMb",
           "maxFileSizeMb",
           "uploadableFileTypes",

Get diff files from Workflow Page

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 23, 2026

Backend memory usage comparison

Before GC

Metric base (MB) head (MB) Diff (MB) Diff (%)
VmRSS 327.04 MB 321.09 MB -5.95 MB -1.81%
VmHWM 327.04 MB 321.09 MB -5.95 MB -1.81%
VmSize 23120.27 MB 23113.73 MB -6.53 MB -0.02%
VmData 1390.38 MB 1383.27 MB -7.11 MB -0.51%

After GC

Metric base (MB) head (MB) Diff (MB) Diff (%)
VmRSS 327.05 MB 321.10 MB -5.95 MB -1.82%
VmHWM 327.05 MB 321.10 MB -5.95 MB -1.82%
VmSize 23120.52 MB 23113.73 MB -6.78 MB -0.02%
VmData 1390.63 MB 1383.27 MB -7.36 MB -0.52%

After Request

Metric base (MB) head (MB) Diff (MB) Diff (%)
VmRSS 327.47 MB 321.52 MB -5.94 MB -1.81%
VmHWM 327.47 MB 321.52 MB -5.94 MB -1.81%
VmSize 23120.69 MB 23113.82 MB -6.87 MB -0.02%
VmData 1390.72 MB 1383.35 MB -7.36 MB -0.52%

See workflow logs for details

@kakkokari-gtyih kakkokari-gtyih marked this pull request as ready for review January 23, 2026 17:33
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jan 23, 2026
@kakkokari-gtyih kakkokari-gtyih changed the title Add canCreateChannel role policy enhance: Add canCreateChannel role policy Jan 23, 2026
@kakkokari-gtyih kakkokari-gtyih marked this pull request as draft January 23, 2026 18:30
@kakkokari-gtyih kakkokari-gtyih marked this pull request as ready for review January 23, 2026 18:34
@kakkokari-gtyih
Copy link
Copy Markdown
Contributor

なおした(Changelogだけまだ)

@kakkokari-gtyih
Copy link
Copy Markdown
Contributor

コンフリクト解消

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

packages/backend Server side specific issue/PR packages/frontend Client side specific issue/PR packages/misskey-js size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Development

Successfully merging this pull request may close these issues.

チャンネルを作成できるか否かをロールで制御できるようにする

3 participants