-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: 特定ユーザーからのリアクションをブロックする機能の追加 #14986
Conversation
- BlockingReactionUserエンティティの追加 - blocking-reaction-userエンドポイントの追加 - 関連するフロントエンドの追加 Migrationがあります。
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ 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 ☔ View full report in Codecov by Sentry. |
このPRによるapi.jsonの差分 差分はこちら--- 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", |
Thank you for sending us a great Pull Request! 👍 example: pnpm run build-misskey-js-with-types |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- ja-JP以外の翻訳ファイルはCrowdin以外から編集すると不整合が起きるため、ja-JP以外の翻訳の変更はすべて取り消してください
- lint / code styleの修正を行ってください(見つけた分だけ下に足れ下げておきます)
- ユーザーエンティティ関連のbackend testのスキーマが変更に追従していません。適切に修正してください
- BlockingReactionUserのjson schema(
/src/models/json-schema
内)が定義されていないにもかかわらずPacked<'BlockingReactionUser'>
が使用されています。スキーマを作成して適切にインポートしたうえで使用するようにしてください - ↑をやったうえで
pnpm build-misskey-js-with-types
を再度実行してください(misskey-jsのautogen配下は自動生成なので手動で変更しないでください)
@@ -82,6 +82,7 @@ import { MiReversiGame } from '@/models/ReversiGame.js'; | |||
import { Config } from '@/config.js'; | |||
import MisskeyLogger from '@/logger.js'; | |||
import { bindThis } from '@/decorators.js'; | |||
import {MiBlockingReactionUser} from "@/models/_.js"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import {MiBlockingReactionUser} from "@/models/_.js"; | |
import { MiBlockingReactionUser } from '@/models/_.js'; |
lint / code style
import { DI } from '@/di-symbols.js'; | ||
import { GetterService } from '@/server/api/GetterService.js'; | ||
import { ApiError } from '../../error.js'; | ||
import {BlockingReactionUserService} from "@/core/BlockingReactionUserService.js"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import {BlockingReactionUserService} from "@/core/BlockingReactionUserService.js"; | |
import { BlockingReactionUserService } from '@/core/BlockingReactionUserService.js'; |
lint / code style
import { UserWebhookService } from '@/core/UserWebhookService.js'; | ||
import { bindThis } from '@/decorators.js'; | ||
import { CacheService } from '@/core/CacheService.js'; | ||
import {MiBlockingReactionUser} from "@/models/_.js"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import {MiBlockingReactionUser} from "@/models/_.js"; | |
import type { MiBlockingReactionUser } from '@/models/_.js'; |
lint / code style
blockerId: blocker.id, | ||
blockee, | ||
blockeeId: blockee.id, | ||
} as MiBlockingReactionUser; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} as MiBlockingReactionUser; | |
} satisfies MiBlockingReactionUser; |
import type { MiUser } from '@/models/User.js'; | ||
import { bindThis } from '@/decorators.js'; | ||
import { IdService } from '@/core/IdService.js'; | ||
import { MiBlockingReactionUser } from '@/models/BlockingReactionUser.js'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import { MiBlockingReactionUser } from '@/models/BlockingReactionUser.js'; | |
import type { MiBlockingReactionUser } from '@/models/BlockingReactionUser.js'; |
import ms from 'ms'; | ||
import { Inject, Injectable } from '@nestjs/common'; | ||
import { Endpoint } from '@/server/api/endpoint-base.js'; | ||
import type {UsersRepository, BlockingsRepository, BlockingReactionUsersRepository} from '@/models/_.js'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import type {UsersRepository, BlockingsRepository, BlockingReactionUsersRepository} from '@/models/_.js'; | |
import type { UsersRepository, BlockingsRepository, BlockingReactionUsersRepository } from '@/models/_.js'; |
lint
新しいテーブルを作るより、既存のBlockingテーブルにカラムを追加する方がシンプルになりそうな気がしました |
// Since we already have the blocker and blockee, we do not need to fetch | ||
// them in the query above and can just manually insert them here. | ||
blocking.blocker = blocker; | ||
blocking.blockee = blockee; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
上記の処理は不要に見受けられるのですが、いかがでしょうか。
これ以降、blockingはidしか使われていないようです。
既存箇所の変更を嫌ってテーブルを作成しましたが、たしかにカラム追加のほうがシンプルになる気がします。 |
Migrationがあります。
What
特定ユーザーからのリアクションをブロックする
Why
脈絡がなかったりよくわからん絵文字でリアクションをする人からリアクションを受け取りたくないが、ブロックまではする必要がないことがある。
Additional info (optional)
Checklist