Skip to content

enhance: センシティブフラグ変更の由来をdrive_fileに持つ#15452

Open
samunohito wants to merge 15 commits intomisskey-dev:developfrom
samunohito:enhance/15443-sensitive-reason
Open

enhance: センシティブフラグ変更の由来をdrive_fileに持つ#15452
samunohito wants to merge 15 commits intomisskey-dev:developfrom
samunohito:enhance/15443-sensitive-reason

Conversation

@samunohito
Copy link
Copy Markdown
Member

@samunohito samunohito commented Feb 11, 2025

What

モデレータによりセンシティブ設定されたファイルは、ユーザ側から非センシティブ化出来ないようにします。
drive_file.isSensitiveが誰による操作で更新されたかを保持し、以下のすべてを満たす場合はエラーとするようにしました。

  • 非センシティブに変更するとき
  • 変更をかけるアカウントが非モデレータ(ユーザ)のとき
  • センシティブとした理由がモデレータによる操作だったとき

Why

fix #15443

Additional info (optional)

ローカルで以下を動作確認

  • 投稿フォームの添付ファイル部分を右クリック
    • ユーザがセンシティブ設定できる
    • ユーザによりセンシティブ設定されたものはユーザの手で解除できる
    • モデレータによりセンシティブ設定されたものはユーザの手で解除できない
    • 「ファイルにNSFWを常に付与」ポリシーが付与されたユーザは解除できない
    • 「ファイルにNSFWを常に付与」ポリシーが付与されたモデレータは解除できない(自分が投稿するとき)
  • ドライブの詳細ページの👁アイコン
    • ユーザがセンシティブ設定できる
    • ユーザによりセンシティブ設定されたものはユーザの手で解除できる
    • モデレータによりセンシティブ設定されたものはユーザの手で解除できない
    • 「ファイルにNSFWを常に付与」ポリシーが付与されたユーザは解除できない
    • 「ファイルにNSFWを常に付与」ポリシーが付与されたモデレータは解除できない(自分が投稿したもの)
  • ドライブの一覧ページで任意のファイルを右クリック
    • ユーザがセンシティブ設定できる
    • ユーザによりセンシティブ設定されたものはユーザの手で解除できる
    • モデレータによりセンシティブ設定されたものはユーザの手で解除できない
    • 「ファイルにNSFWを常に付与」ポリシーが付与されたユーザは解除できない
    • 「ファイルにNSFWを常に付与」ポリシーが付与されたモデレータは解除できない(自分が投稿したもの)
  • コンパネのファイル一覧
    • モデレータがセンシティブ設定できる
    • ユーザによりセンシティブ設定されたものはモデレータの手で解除できる
    • モデレータによりセンシティブ設定されたものはモデレータの手で解除できる
    • 「ファイルにNSFWを常に付与」ポリシーが付与されたモデレータは解除できない(自分が投稿したもの)
    • 「ファイルにNSFWを常に付与」ポリシーが付与されたモデレータは解除できない(他人が投稿したもの)

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

@github-actions github-actions Bot added the packages/backend Server side specific issue/PR label Feb 11, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 11, 2025

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

差分はこちら
--- base
+++ head
@@ -33774,6 +33774,15 @@
                       }
                     }
                   },
+                  "NSFW_MARKED_BY_MODERATOR": {
+                    "value": {
+                      "error": {
+                        "message": "Cannot be removed because it has been flagged as NSFW by a moderator.",
+                        "code": "NSFW_MARKED_BY_MODERATOR",
+                        "id": "c9ff65ab-c344-d715-f3c8-0c325f852951"
+                      }
+                    }
+                  },
                   "INVALID_PARAM": {
                     "value": {
                       "error": {
@@ -80914,6 +80923,15 @@
           "isSensitive": {
             "type": "boolean"
           },
+          "sensitiveChangeReason": {
+            "type": "string",
+            "enum": [
+              "user",
+              "moderator",
+              "auto",
+              "none"
+            ]
+          },
           "blurhash": {
             "type": [
               "string",
@@ -81005,6 +81023,7 @@
           "md5",
           "size",
           "isSensitive",
+          "sensitiveChangeReason",
           "blurhash",
           "properties",
           "url",

Get diff files from Workflow Page

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 11, 2025

Codecov Report

❌ Patch coverage is 37.60000% with 78 lines in your changes missing coverage. Please review.
✅ Project coverage is 40.33%. Comparing base (cf35208) to head (d1115ef).
⚠️ Report is 1891 commits behind head on develop.

Files with missing lines Patch % Lines
packages/backend/src/core/DriveService.ts 19.23% 42 Missing ⚠️
packages/frontend/src/pages/admin-file.vue 0.00% 11 Missing ⚠️
packages/frontend/src/pages/drive.file.info.vue 0.00% 10 Missing ⚠️
...ckages/frontend/src/scripts/get-drive-file-menu.ts 0.00% 10 Missing ⚠️
...end/src/server/api/endpoints/drive/files/update.ts 66.66% 3 Missing ⚠️
...ackend/src/core/entities/DriveFileEntityService.ts 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           develop   #15452       +/-   ##
============================================
+ Coverage    18.83%   40.33%   +21.50%     
============================================
  Files          768     1611      +843     
  Lines       111567   210779    +99212     
  Branches      1236     4087     +2851     
============================================
+ Hits         21013    85020    +64007     
- Misses       89963   125117    +35154     
- Partials       591      642       +51     

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

@kakkokari-gtyih kakkokari-gtyih added this to the [DO NOT MERGE THESE YET] v2025.3.0~ milestone Feb 11, 2025
@samunohito samunohito force-pushed the enhance/15443-sensitive-reason branch from 5d133cd to 3e1727d Compare February 11, 2025 08:58
@samunohito samunohito marked this pull request as ready for review February 11, 2025 11:09
@samunohito
Copy link
Copy Markdown
Member Author

open

@kakkokari-gtyih kakkokari-gtyih modified the milestones: [DO NOT MERGE THESE YET] v2025.3.0~, v2025.2.1 Feb 15, 2025
@kakkokari-gtyih
Copy link
Copy Markdown
Contributor

バックエンドのe2eのほうのテストがあったほうが良さそう

@kakkokari-gtyih kakkokari-gtyih modified the milestones: v2025.2.1, v2025.3.0 Feb 27, 2025
@samunohito samunohito modified the milestones: v2025.3.2, v2025.5.x Apr 15, 2025
@Sayamame-beans Sayamame-beans moved this from Todo to Needs to review in [実験中] 管理用 Apr 29, 2025
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

Projects

Status: Needs to review

3 participants