misskey-dev / misskey

🌎 A completely free and open interplanetary microblogging platform 🚀
https://misskey-hub.net/
GNU Affero General Public License v3.0
10.09k stars 1.38k forks source link

Feat: 特定ユーザーからのリアクションをブロックする機能の追加 #14986

Closed sakuhanight closed 4 days ago

sakuhanight commented 5 days ago

What

特定ユーザーからのリアクションをブロックする

Why

脈絡がなかったりよくわからん絵文字でリアクションをする人からリアクションを受け取りたくないが、ブロックまではする必要がないことがある。

Additional info (optional)

Checklist

codecov[bot] commented 5 days ago

Codecov Report

Attention: Patch coverage is 64.90251% with 252 lines in your changes missing coverage. Please review.

Project coverage is 40.73%. Comparing base (eed45c7) to head (51bc83c). Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
...es/backend/src/core/BlockingReactionUserService.ts 53.63% 51 Missing :warning:
...ackages/frontend/src/pages/settings/mute-block.vue 0.00% 48 Missing :warning:
...ver/api/endpoints/blocking-reaction-user/delete.ts 58.55% 46 Missing :warning:
...ver/api/endpoints/blocking-reaction-user/create.ts 59.09% 45 Missing :warning:
...core/entities/BlockingReactionUserEntityService.ts 53.44% 27 Missing :warning:
...erver/api/endpoints/blocking-reaction-user/list.ts 68.85% 19 Missing :warning:
packages/frontend/src/scripts/get-user-menu.ts 0.00% 14 Missing :warning:
packages/backend/src/core/ReactionService.ts 50.00% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #14986 +/- ## =========================================== + Coverage 39.97% 40.73% +0.76% =========================================== Files 1561 1571 +10 Lines 197256 203748 +6492 Branches 3607 3350 -257 =========================================== + Hits 78849 82997 +4148 - Misses 117835 120179 +2344 Partials 572 572 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

github-actions[bot] commented 5 days ago

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

差分はこちら ```diff --- base +++ head @@ -20952,6 +20952,580 @@ } } }, + "/blocking-reaction-user/create": { + "post": { + "operationId": "blocking-reaction-user___create", + "summary": "blocking-reaction-user/create", + "description": "No description provided.\n\n**Credential required**: *Yes* / **Permission**: *write:blocks*", + "externalDocs": { + "description": "Source code", + "url": "https://github.com/misskey-dev/misskey/blob/develop/packages/backend/src/server/api/endpoints/blocking-reaction-user/create.ts" + }, + "tags": [ + "account" + ], + "security": [ + { + "bearerAuth": [] + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "userId": { + "type": "string", + "format": "misskey:id" + } + }, + "required": [ + "userId" + ] + } + } + } + }, + "responses": { + "200": { + "description": "OK (with results)", + "content": { + "application/json": { + "schema": { + "type": "object", + "$ref": "#/components/schemas/UserDetailedNotMe" + } + } + } + }, + "400": { + "description": "Client error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + }, + "examples": { + "NO_SUCH_USER": { + "value": { + "error": { + "message": "No such user.", + "code": "NO_SUCH_USER", + "id": "7cc4f851-e2f1-4621-9633-ec9e1d00c01e" + } + } + }, + "BLOCKEE_IS_YOURSELF": { + "value": { + "error": { + "message": "Blockee is yourself.", + "code": "BLOCKEE_IS_YOURSELF", + "id": "88b19138-f28d-42c0-8499-6a31bbd0fdc6" + } + } + }, + "ALREADY_BLOCKING": { + "value": { + "error": { + "message": "You are already blocking that user.", + "code": "ALREADY_BLOCKING", + "id": "787fed64-acb9-464a-82eb-afbd745b9614" + } + } + }, + "INVALID_PARAM": { + "value": { + "error": { + "message": "Invalid param.", + "code": "INVALID_PARAM", + "id": "3d81ceae-475f-4600-b2a8-2bc116157532" + } + } + } + } + } + } + }, + "401": { + "description": "Authentication error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + }, + "examples": { + "CREDENTIAL_REQUIRED": { + "value": { + "error": { + "message": "Credential required.", + "code": "CREDENTIAL_REQUIRED", + "id": "1384574d-a912-4b81-8601-c7b1c4085df1" + } + } + } + } + } + } + }, + "403": { + "description": "Forbidden error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + }, + "examples": { + "AUTHENTICATION_FAILED": { + "value": { + "error": { + "message": "Authentication failed. Please ensure your token is correct.", + "code": "AUTHENTICATION_FAILED", + "id": "b0a7f5f8-dc2f-4171-b91f-de88ad238e14" + } + } + } + } + } + } + }, + "418": { + "description": "I'm Ai", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + }, + "examples": { + "I_AM_AI": { + "value": { + "error": { + "message": "You sent a request to Ai-chan, Misskey's showgirl, instead of the server.", + "code": "I_AM_AI", + "id": "60c46cd1-f23a-46b1-bebe-5d2b73951a84" + } + } + } + } + } + } + }, + "429": { + "description": "To many requests", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + }, + "examples": { + "RATE_LIMIT_EXCEEDED": { + "value": { + "error": { + "message": "Rate limit exceeded. Please try again later.", + "code": "RATE_LIMIT_EXCEEDED", + "id": "d5826d14-3982-4d2e-8011-b9e9f02499ef" + } + } + } + } + } + } + }, + "500": { + "description": "Internal server error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + }, + "examples": { + "INTERNAL_ERROR": { + "value": { + "error": { + "message": "Internal error occurred. Please contact us if the error persists.", + "code": "INTERNAL_ERROR", + "id": "5d37dbcb-891e-41ca-a3d6-e690c97775ac" + } + } + } + } + } + } + } + } + } + }, + "/blocking-reaction-user/delete": { + "post": { + "operationId": "blocking-reaction-user___delete", + "summary": "blocking-reaction-user/delete", + "description": "No description provided.\n\n**Credential required**: *Yes* / **Permission**: *write:blocks*", + "externalDocs": { + "description": "Source code", + "url": "https://github.com/misskey-dev/misskey/blob/develop/packages/backend/src/server/api/endpoints/blocking-reaction-user/delete.ts" + }, + "tags": [ + "account" + ], + "security": [ + { + "bearerAuth": [] + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "userId": { + "type": "string", + "format": "misskey:id" + } + }, + "required": [ + "userId" + ] + } + } + } + }, + "responses": { + "200": { + "description": "OK (with results)", + "content": { + "application/json": { + "schema": { + "type": "object", + "$ref": "#/components/schemas/UserDetailedNotMe" + } + } + } + }, + "400": { + "description": "Client error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + }, + "examples": { + "NO_SUCH_USER": { + "value": { + "error": { + "message": "No such user.", + "code": "NO_SUCH_USER", + "id": "8621d8bf-c358-4303-a066-5ea78610eb3f" + } + } + }, + "BLOCKEE_IS_YOURSELF": { + "value": { + "error": { + "message": "Blockee is yourself.", + "code": "BLOCKEE_IS_YOURSELF", + "id": "06f6fac6-524b-473c-a354-e97a40ae6eac" + } + } + }, + "NOT_BLOCKING": { + "value": { + "error": { + "message": "You are not blocking that user.", + "code": "NOT_BLOCKING", + "id": "291b2efa-60c6-45c0-9f6a-045c8f9b02cd" + } + } + }, + "INVALID_PARAM": { + "value": { + "error": { + "message": "Invalid param.", + "code": "INVALID_PARAM", + "id": "3d81ceae-475f-4600-b2a8-2bc116157532" + } + } + } + } + } + } + }, + "401": { + "description": "Authentication error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + }, + "examples": { + "CREDENTIAL_REQUIRED": { + "value": { + "error": { + "message": "Credential required.", + "code": "CREDENTIAL_REQUIRED", + "id": "1384574d-a912-4b81-8601-c7b1c4085df1" + } + } + } + } + } + } + }, + "403": { + "description": "Forbidden error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + }, + "examples": { + "AUTHENTICATION_FAILED": { + "value": { + "error": { + "message": "Authentication failed. Please ensure your token is correct.", + "code": "AUTHENTICATION_FAILED", + "id": "b0a7f5f8-dc2f-4171-b91f-de88ad238e14" + } + } + } + } + } + } + }, + "418": { + "description": "I'm Ai", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + }, + "examples": { + "I_AM_AI": { + "value": { + "error": { + "message": "You sent a request to Ai-chan, Misskey's showgirl, instead of the server.", + "code": "I_AM_AI", + "id": "60c46cd1-f23a-46b1-bebe-5d2b73951a84" + } + } + } + } + } + } + }, + "429": { + "description": "To many requests", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + }, + "examples": { + "RATE_LIMIT_EXCEEDED": { + "value": { + "error": { + "message": "Rate limit exceeded. Please try again later.", + "code": "RATE_LIMIT_EXCEEDED", + "id": "d5826d14-3982-4d2e-8011-b9e9f02499ef" + } + } + } + } + } + } + }, + "500": { + "description": "Internal server error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + }, + "examples": { + "INTERNAL_ERROR": { + "value": { + "error": { + "message": "Internal error occurred. Please contact us if the error persists.", + "code": "INTERNAL_ERROR", + "id": "5d37dbcb-891e-41ca-a3d6-e690c97775ac" + } + } + } + } + } + } + } + } + } + }, + "/blocking-reaction-user/list": { + "post": { + "operationId": "blocking-reaction-user___list", + "summary": "blocking-reaction-user/list", + "description": "No description provided.\n\n**Credential required**: *Yes* / **Permission**: *read:blocks*", + "externalDocs": { + "description": "Source code", + "url": "https://github.com/misskey-dev/misskey/blob/develop/packages/backend/src/server/api/endpoints/blocking-reaction-user/list.ts" + }, + "tags": [ + "account" + ], + "security": [ + { + "bearerAuth": [] + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "limit": { + "type": "integer", + "minimum": 1, + "maximum": 100, + "default": 30 + }, + "sinceId": { + "type": "string", + "format": "misskey:id" + }, + "untilId": { + "type": "string", + "format": "misskey:id" + } + } + } + } + } + }, + "responses": { + "200": { + "description": "OK (with results)", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/components/schemas/Blocking" + } + } + } + } + }, + "400": { + "description": "Client error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + }, + "examples": { + "INVALID_PARAM": { + "value": { + "error": { + "message": "Invalid param.", + "code": "INVALID_PARAM", + "id": "3d81ceae-475f-4600-b2a8-2bc116157532" + } + } + } + } + } + } + }, + "401": { + "description": "Authentication error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + }, + "examples": { + "CREDENTIAL_REQUIRED": { + "value": { + "error": { + "message": "Credential required.", + "code": "CREDENTIAL_REQUIRED", + "id": "1384574d-a912-4b81-8601-c7b1c4085df1" + } + } + } + } + } + } + }, + "403": { + "description": "Forbidden error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + }, + "examples": { + "AUTHENTICATION_FAILED": { + "value": { + "error": { + "message": "Authentication failed. Please ensure your token is correct.", + "code": "AUTHENTICATION_FAILED", + "id": "b0a7f5f8-dc2f-4171-b91f-de88ad238e14" + } + } + } + } + } + } + }, + "418": { + "description": "I'm Ai", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + }, + "examples": { + "I_AM_AI": { + "value": { + "error": { + "message": "You sent a request to Ai-chan, Misskey's showgirl, instead of the server.", + "code": "I_AM_AI", + "id": "60c46cd1-f23a-46b1-bebe-5d2b73951a84" + } + } + } + } + } + } + }, + "500": { + "description": "Internal server error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + }, + "examples": { + "INTERNAL_ERROR": { + "value": { + "error": { + "message": "Internal error occurred. Please contact us if the error persists.", + "code": "INTERNAL_ERROR", + "id": "5d37dbcb-891e-41ca-a3d6-e690c97775ac" + } + } + } + } + } + } + } + } + } + }, "/channels/create": { "post": { "operationId": "channels___create", ``` [Get diff files from Workflow Page](https://github.com/misskey-dev/misskey/actions/runs/11879227348)
github-actions[bot] commented 5 days ago

Thank you for sending us a great Pull Request! 👍 Please regenerate misskey-js type definitions! 🙏

example:

pnpm run build-misskey-js-with-types
syuilo commented 5 days ago

新しいテーブルを作るより、既存のBlockingテーブルにカラムを追加する方がシンプルになりそうな気がしました

sakuhanight commented 4 days ago

新しいテーブルを作るより、既存のBlockingテーブルにカラムを追加する方がシンプルになりそうな気がしました

既存箇所の変更を嫌ってテーブルを作成しましたが、たしかにカラム追加のほうがシンプルになる気がします。 カラム追加での変更を作成、指摘頂いた箇所を修正し、改めてPR出させてもらおうと思います。 レビューありがとうございました。