Skip to content

enhance: ノート投稿関連のロールポリシー追加#16379

Open
kakkokari-gtyih wants to merge 32 commits into
misskey-dev:developfrom
kakkokari-gtyih:enh-add-note-policies
Open

enhance: ノート投稿関連のロールポリシー追加#16379
kakkokari-gtyih wants to merge 32 commits into
misskey-dev:developfrom
kakkokari-gtyih:enh-add-note-policies

Conversation

@kakkokari-gtyih
Copy link
Copy Markdown
Contributor

@kakkokari-gtyih kakkokari-gtyih commented Aug 8, 2025

What

  • ノートの投稿の一切の可否 canNote
  • リノート・引用の可否 renotePolicy
    • リノート+引用 / リノートのみ / 両方不可
  • 指名ノートの投稿の可否 canCreateSpecifiedNote
  • 連合するノートの投稿の可否 canFederateNote
  • ノートに添付できるファイルの最大数 noteFilesLimit
    • 0で添付不可
    • ※上限16は固定

を制御できるように

+ロールポリシーにより投稿拒否・投稿範囲変更が発生するケースのe2eを追加

+フロントエンドの投稿エラーのダイアログを充実させた

Why

Fix #16375
Fix #16439
Fix #11248
Fix #333

#14646

Additional info (optional)

Checklist

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

@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 8, 2025

Codecov Report

❌ Patch coverage is 10.47120% with 171 lines in your changes missing coverage. Please review.
✅ Project coverage is 25.15%. Comparing base (408d056) to head (7dc679c).
⚠️ Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
packages/frontend/src/components/MkPostForm.vue 0.00% 73 Missing and 11 partials ⚠️
...s/backend/src/server/api/endpoints/notes/create.ts 0.00% 46 Missing and 1 partial ⚠️
packages/frontend/src/utility/get-note-menu.ts 0.00% 10 Missing and 4 partials ⚠️
packages/frontend/src/os.ts 0.00% 7 Missing and 4 partials ⚠️
packages/backend/src/core/NoteCreateService.ts 66.66% 6 Missing ⚠️
packages/frontend/src/components/MkNote.vue 0.00% 2 Missing and 3 partials ⚠️
packages/backend/src/core/RoleService.ts 77.77% 1 Missing and 1 partial ⚠️
...ges/frontend/src/components/MkPostFormAttaches.vue 0.00% 1 Missing ⚠️
packages/frontend/src/utility/get-appear-note.ts 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #16379      +/-   ##
===========================================
+ Coverage    15.22%   25.15%   +9.93%     
===========================================
  Files          247     1157     +910     
  Lines        12322    39641   +27319     
  Branches      4170    11045    +6875     
===========================================
+ Hits          1876     9972    +8096     
- Misses        8183    23804   +15621     
- Partials      2263     5865    +3602     

☔ 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.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Aug 8, 2025

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

差分はこちら
--- base
+++ head
@@ -66706,6 +66706,15 @@
                   "$ref": "#/components/schemas/Error"
                 },
                 "examples": {
+                  "CANNOT_CREATE_NOTE": {
+                    "value": {
+                      "error": {
+                        "message": "You are not allowed to create notes.",
+                        "code": "CANNOT_CREATE_NOTE",
+                        "id": "f35c0bd4-9dca-4998-ae4b-fa0e7c54d16a"
+                      }
+                    }
+                  },
                   "NO_SUCH_RENOTE_TARGET": {
                     "value": {
                       "error": {
@@ -66832,6 +66841,51 @@
                       }
                     }
                   },
+                  "CONTAINS_TOO_MANY_FILES": {
+                    "value": {
+                      "error": {
+                        "message": "Cannot post because too many files are attached.",
+                        "code": "CONTAINS_TOO_MANY_FILES",
+                        "id": "8d28ca32-a244-4cf7-bc29-97895fdc3604"
+                      }
+                    }
+                  },
+                  "RENOTE_FORBIDDEN": {
+                    "value": {
+                      "error": {
+                        "message": "You are not allowed to Renote.",
+                        "code": "RENOTE_FORBIDDEN",
+                        "id": "c5b0bcc1-9db1-4178-b130-920a4e150b58"
+                      }
+                    }
+                  },
+                  "QUOTE_FORBIDDEN": {
+                    "value": {
+                      "error": {
+                        "message": "You are not allowed to quote.",
+                        "code": "QUOTE_FORBIDDEN",
+                        "id": "ae77a039-588a-40c3-8358-cc9c15ec7bbb"
+                      }
+                    }
+                  },
+                  "SPECIFIED_NOTE_CREATION_FORBIDDEN": {
+                    "value": {
+                      "error": {
+                        "message": "You are not allowed to send specified notes.",
+                        "code": "SPECIFIED_NOTE_CREATION_FORBIDDEN",
+                        "id": "fe35a6b4-f595-4cbc-ab56-f31fa68be1f0"
+                      }
+                    }
+                  },
+                  "REMOTE_SPECIFIED_NOTE_CREATION_FORBIDDEN": {
+                    "value": {
+                      "error": {
+                        "message": "You are not allowed to send specified notes to remote users.",
+                        "code": "REMOTE_SPECIFIED_NOTE_CREATION_FORBIDDEN",
+                        "id": "dd9e27c6-7cba-4587-92c7-672c82d9cc46"
+                      }
+                    }
+                  },
                   "INVALID_PARAM": {
                     "value": {
                       "error": {
@@ -67570,33 +67624,6 @@
                       }
                     }
                   },
-                  "CANNOT_RENOTE_OUTSIDE_OF_CHANNEL": {
-                    "value": {
-                      "error": {
-                        "message": "Cannot renote outside of channel.",
-                        "code": "CANNOT_RENOTE_OUTSIDE_OF_CHANNEL",
-                        "id": "33510210-8452-094c-6227-4a6c05d99f00"
-                      }
-                    }
-                  },
-                  "CONTAINS_PROHIBITED_WORDS": {
-                    "value": {
-                      "error": {
-                        "message": "Cannot post because it contains prohibited words.",
-                        "code": "CONTAINS_PROHIBITED_WORDS",
-                        "id": "aa6e01d3-a85c-669d-758a-76aab43af334"
-                      }
-                    }
-                  },
-                  "CONTAINS_TOO_MANY_MENTIONS": {
-                    "value": {
-                      "error": {
-                        "message": "Cannot post because it exceeds the allowed number of mentions.",
-                        "code": "CONTAINS_TOO_MANY_MENTIONS",
-                        "id": "4de0363a-3046-481b-9b0f-feff3e211025"
-                      }
-                    }
-                  },
                   "TOO_MANY_DRAFTS": {
                     "value": {
                       "error": {
@@ -92822,6 +92849,26 @@
           },
           "watermarkAvailable": {
             "type": "boolean"
+          },
+          "canNote": {
+            "type": "boolean"
+          },
+          "renotePolicy": {
+            "type": "string",
+            "enum": [
+              "allow",
+              "renoteOnly",
+              "disallow"
+            ]
+          },
+          "canCreateSpecifiedNote": {
+            "type": "boolean"
+          },
+          "canFederateNote": {
+            "type": "boolean"
+          },
+          "noteFilesLimit": {
+            "type": "integer"
           }
         },
         "required": [
@@ -92863,7 +92910,12 @@
           "chatAvailability",
           "noteDraftLimit",
           "scheduledNoteLimit",
-          "watermarkAvailable"
+          "watermarkAvailable",
+          "canNote",
+          "renotePolicy",
+          "canCreateSpecifiedNote",
+          "canFederateNote",
+          "noteFilesLimit"
         ]
       },
       "ReversiGameLite": {

Get diff files from Workflow Page

Comment thread packages/backend/src/core/NoteCreateService.ts
@kakkokari-gtyih kakkokari-gtyih marked this pull request as draft August 9, 2025 05:42
@kakkokari-gtyih
Copy link
Copy Markdown
Contributor Author

memo: frontend-sharedに追加したポリシーのkeyを追記する

@kakkokari-gtyih
Copy link
Copy Markdown
Contributor Author

コンフリクト解消

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 22, 2026

Backend memory usage comparison

Before GC

Metric base (MB) head (MB) Diff (MB) Diff (%)
VmRSS 298.92 MB 308.06 MB +9.14 MB +3.05%
VmHWM 298.92 MB 308.06 MB +9.14 MB +3.05%
VmSize 23075.83 MB 23085.30 MB +9.46 MB +0.04%
VmData 1342.17 MB 1351.28 MB +9.11 MB +0.67%

After GC

Metric base (MB) head (MB) Diff (MB) Diff (%)
VmRSS 298.95 MB 308.07 MB +9.12 MB +3.05%
VmHWM 298.95 MB 308.07 MB +9.12 MB +3.05%
VmSize 23075.99 MB 23085.30 MB +9.30 MB +0.04%
VmData 1342.34 MB 1351.28 MB +8.94 MB +0.66%

After Request

Metric base (MB) head (MB) Diff (MB) Diff (%)
VmRSS 299.39 MB 308.38 MB +8.99 MB +3.00%
VmHWM 299.39 MB 308.38 MB +8.99 MB +3.00%
VmSize 23076.24 MB 23085.30 MB +9.05 MB +0.03%
VmData 1342.59 MB 1351.28 MB +8.69 MB +0.64%

See workflow logs for details

@kakkokari-gtyih
Copy link
Copy Markdown
Contributor Author

コンフリクト解消

@kakkokari-gtyih kakkokari-gtyih marked this pull request as ready for review May 11, 2026 07:01
@dosubot dosubot Bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label May 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

packages/backend:test packages/backend Server side specific issue/PR packages/frontend Client side specific issue/PR packages/misskey-js size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

2 participants