Skip to content
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: 通報を受けた際にメールまたはWebhookで通知を送出出来るようにする #13758

Merged
merged 43 commits into from
Jun 8, 2024
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
4315adc
feat: 通報を受けた際にメールまたはWebhookで通知を送出出来るようにする
samunohito Apr 21, 2024
ccd9d8f
モデログに対応&エンドポイントを単一オブジェクトでのサポートに変更(API経由で大量に作るシチュエーションもないと思うので)
samunohito Apr 28, 2024
763fac5
Merge branch 'develop' into feature/abuse_system_webhook
samunohito Apr 28, 2024
ef081ba
fix spdx
samunohito Apr 28, 2024
39d07f0
fix migration
samunohito Apr 28, 2024
cb9ab79
fix migration
samunohito Apr 29, 2024
a313d52
fix models
samunohito Apr 29, 2024
309e3aa
add e2e webhook
samunohito Apr 29, 2024
c4a600c
tweak
samunohito Apr 29, 2024
d5467ca
fix modlog
samunohito Apr 29, 2024
0691726
fix bugs
samunohito Apr 29, 2024
80de435
add tests and fix bugs
samunohito Apr 30, 2024
2921164
add tests and fix bugs
samunohito May 2, 2024
f91e382
add tests
samunohito May 3, 2024
2673391
fix path
samunohito May 3, 2024
1b0ae41
Merge remote-tracking branch 'origin/develop' into feature/abuse_syst…
samunohito May 3, 2024
9a6c8da
regenerate locale
samunohito May 3, 2024
7e5bace
混入除去
samunohito May 3, 2024
3aa200f
混入除去
samunohito May 3, 2024
743f853
Merge remote-tracking branch 'origin/feature/abuse_system_webhook' in…
samunohito May 3, 2024
d57497c
Merge branch 'develop' into feature/abuse_system_webhook
samunohito May 6, 2024
f1d17e9
add abuseReportResolved
samunohito May 7, 2024
074e9f5
fix pnpm-lock.yaml
samunohito May 7, 2024
f12d339
add abuseReportResolved test
samunohito May 7, 2024
124d116
fix bugs
samunohito May 7, 2024
17777d2
fix ui
samunohito May 7, 2024
921acfe
add tests
samunohito May 7, 2024
e9efcc0
Merge branch 'develop' into feature/abuse_system_webhook
samunohito May 7, 2024
482ceeb
fix CHANGELOG.md
samunohito May 7, 2024
02bda2d
add tests
samunohito May 7, 2024
a7a32e0
add RoleService.getModeratorIds tests
samunohito May 8, 2024
7d52cdf
WebhookServiceをUserとSystemに分割
samunohito Jun 7, 2024
3703df2
Merge branch 'refs/heads/develop' into feature/abuse_system_webhook
samunohito Jun 7, 2024
b841cd3
fix CHANGELOG.md
samunohito Jun 7, 2024
2da77a5
fix test
samunohito Jun 7, 2024
7ae54fd
insertOneを使う用に
samunohito Jun 7, 2024
a75d75b
fix
samunohito Jun 7, 2024
a7a20c2
regenerate locales
samunohito Jun 7, 2024
99d6d19
revert version
samunohito Jun 7, 2024
3a72194
separate webhook job queue
syuilo Jun 8, 2024
6fbd1d9
fix
syuilo Jun 8, 2024
571d7ad
:art:
syuilo Jun 8, 2024
189265b
Update QueueProcessorService.ts
syuilo Jun 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- 悪意のある第三者がリモートユーザーになりすましたアクティビティを受け取れてしまう問題を修正しました。詳しくは[GitHub security advisory](https://github.com/misskey-dev/misskey/security/advisories/GHSA-2vxv-pv3m-3wvj)をご覧ください。

### General
- Feat: 通報を受けた際、または解決した際に、予め登録した宛先に通知を飛ばせるように(mail or webhook) #13705
- Enhance: URLプレビューの有効化・無効化を設定できるように #13569
- Enhance: アンテナでBotによるノートを除外できるように
(Cherry-picked from https://github.com/MisskeyIO/misskey/pull/545)
Expand Down
98 changes: 98 additions & 0 deletions locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4956,6 +4956,10 @@ export interface Locale extends ILocale {
* お問い合わせ
*/
"inquiry": string;
/**
* SystemWebhook
*/
"systemWebhook": string;
"_bubbleGame": {
/**
* 遊び方
Expand Down Expand Up @@ -9237,6 +9241,10 @@ export interface Locale extends ILocale {
* Webhookを作成
*/
"createWebhook": string;
/**
* Webhookを編集
*/
"modifyWebhook": string;
/**
* 名前
*/
Expand Down Expand Up @@ -9283,6 +9291,72 @@ export interface Locale extends ILocale {
*/
"mention": string;
};
"_systemEvents": {
/**
* ユーザーから通報があったとき
*/
"abuseReport": string;
/**
* ユーザーからの通報を処理したとき
*/
"abuseReportResolved": string;
};
/**
* Webhookを削除しますか?
*/
"deleteConfirm": string;
};
"_abuseReport": {
"_notificationRecipient": {
/**
* 通報の通知先を追加
*/
"createRecipient": string;
/**
* 通報の通知先を編集
*/
"modifyRecipient": string;
/**
* 通知先の種類
*/
"recipientType": string;
"_recipientType": {
/**
* メール
*/
"mail": string;
/**
* Webhook
*/
"webhook": string;
"_captions": {
/**
* モデレーター権限を持つユーザーのメールアドレスに通知を送ります(通報を受けた時のみ)
*/
"mail": string;
/**
* 指定したSystemWebhookに通知を送ります(通報を受けた時と通報を解決した時にそれぞれ発信)
*/
"webhook": string;
};
};
/**
* キーワード
*/
"keywords": string;
/**
* 通知先ユーザー
*/
"notifiedUser": string;
/**
* 使用するWebhook
*/
"notifiedWebhook": string;
/**
* 通知先を削除しますか?
*/
"deleteConfirm": string;
};
};
"_moderationLogTypes": {
/**
Expand Down Expand Up @@ -9429,6 +9503,30 @@ export interface Locale extends ILocale {
* ユーザーのバナーを解除
*/
"unsetUserBanner": string;
/**
* SystemWebhookを作成
*/
"createSystemWebhook": string;
/**
* SystemWebhookを更新
*/
"updateSystemWebhook": string;
/**
* SystemWebhookを削除
*/
"deleteSystemWebhook": string;
/**
* 通報の通知先を作成
*/
"createAbuseReportNotificationRecipient": string;
/**
* 通報の通知先を更新
*/
"updateAbuseReportNotificationRecipient": string;
/**
* 通報の通知先を削除
*/
"deleteAbuseReportNotificationRecipient": string;
};
"_fileViewer": {
/**
Expand Down
28 changes: 28 additions & 0 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1235,6 +1235,7 @@ keepOriginalFilenameDescription: "この設定をオフにすると、アップ
noDescription: "説明文はありません"
alwaysConfirmFollow: "フォローの際常に確認する"
inquiry: "お問い合わせ"
systemWebhook: "SystemWebhook"

_bubbleGame:
howToPlay: "遊び方"
Expand Down Expand Up @@ -2449,6 +2450,7 @@ _drivecleaner:

_webhookSettings:
createWebhook: "Webhookを作成"
modifyWebhook: "Webhookを編集"
name: "名前"
secret: "シークレット"
events: "Webhookを実行するタイミング"
Expand All @@ -2461,6 +2463,26 @@ _webhookSettings:
renote: "Renoteされたとき"
reaction: "リアクションがあったとき"
mention: "メンションされたとき"
_systemEvents:
abuseReport: "ユーザーから通報があったとき"
abuseReportResolved: "ユーザーからの通報を処理したとき"
deleteConfirm: "Webhookを削除しますか?"

_abuseReport:
_notificationRecipient:
createRecipient: "通報の通知先を追加"
modifyRecipient: "通報の通知先を編集"
recipientType: "通知先の種類"
_recipientType:
mail: "メール"
webhook: "Webhook"
_captions:
mail: "モデレーター権限を持つユーザーのメールアドレスに通知を送ります(通報を受けた時のみ)"
webhook: "指定したSystemWebhookに通知を送ります(通報を受けた時と通報を解決した時にそれぞれ発信)"
keywords: "キーワード"
notifiedUser: "通知先ユーザー"
notifiedWebhook: "使用するWebhook"
deleteConfirm: "通知先を削除しますか?"

_moderationLogTypes:
createRole: "ロールを作成"
Expand Down Expand Up @@ -2499,6 +2521,12 @@ _moderationLogTypes:
deleteAvatarDecoration: "アイコンデコレーションを削除"
unsetUserAvatar: "ユーザーのアイコンを解除"
unsetUserBanner: "ユーザーのバナーを解除"
createSystemWebhook: "SystemWebhookを作成"
updateSystemWebhook: "SystemWebhookを更新"
deleteSystemWebhook: "SystemWebhookを削除"
createAbuseReportNotificationRecipient: "通報の通知先を作成"
updateAbuseReportNotificationRecipient: "通報の通知先を更新"
deleteAbuseReportNotificationRecipient: "通報の通知先を削除"

_fileViewer:
title: "ファイルの詳細"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

export class AbuseReportNotification1713656541000 {
name = 'AbuseReportNotification1713656541000'

async up(queryRunner) {
await queryRunner.query(`
CREATE TABLE "system_webhook" (
"id" varchar(32) NOT NULL,
"isActive" boolean NOT NULL DEFAULT true,
"updatedAt" timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
"latestSentAt" timestamp with time zone NULL DEFAULT NULL,
"latestStatus" integer NULL DEFAULT NULL,
"name" varchar(255) NOT NULL,
"on" varchar(128) [] NOT NULL DEFAULT '{}'::character varying[],
"url" varchar(1024) NOT NULL,
"secret" varchar(1024) NOT NULL,
CONSTRAINT "PK_system_webhook_id" PRIMARY KEY ("id")
);
CREATE INDEX "IDX_system_webhook_isActive" ON "system_webhook" ("isActive");
CREATE INDEX "IDX_system_webhook_on" ON "system_webhook" USING gin ("on");

CREATE TABLE "abuse_report_notification_recipient" (
"id" varchar(32) NOT NULL,
"isActive" boolean NOT NULL DEFAULT true,
"updatedAt" timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
"name" varchar(255) NOT NULL,
"method" varchar(64) NOT NULL,
"userId" varchar(32) NULL DEFAULT NULL,
"systemWebhookId" varchar(32) NULL DEFAULT NULL,
CONSTRAINT "PK_abuse_report_notification_recipient_id" PRIMARY KEY ("id"),
CONSTRAINT "FK_abuse_report_notification_recipient_userId1" FOREIGN KEY ("userId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION,
CONSTRAINT "FK_abuse_report_notification_recipient_userId2" FOREIGN KEY ("userId") REFERENCES "user_profile"("userId") ON DELETE CASCADE ON UPDATE NO ACTION,
CONSTRAINT "FK_abuse_report_notification_recipient_systemWebhookId" FOREIGN KEY ("systemWebhookId") REFERENCES "system_webhook"("id") ON DELETE CASCADE ON UPDATE NO ACTION
);
CREATE INDEX "IDX_abuse_report_notification_recipient_isActive" ON "abuse_report_notification_recipient" ("isActive");
CREATE INDEX "IDX_abuse_report_notification_recipient_method" ON "abuse_report_notification_recipient" ("method");
CREATE INDEX "IDX_abuse_report_notification_recipient_userId" ON "abuse_report_notification_recipient" ("userId");
CREATE INDEX "IDX_abuse_report_notification_recipient_systemWebhookId" ON "abuse_report_notification_recipient" ("systemWebhookId");
`);
}

async down(queryRunner) {
await queryRunner.query(`
ALTER TABLE "abuse_report_notification_recipient" DROP CONSTRAINT "FK_abuse_report_notification_recipient_userId1";
ALTER TABLE "abuse_report_notification_recipient" DROP CONSTRAINT "FK_abuse_report_notification_recipient_userId2";
ALTER TABLE "abuse_report_notification_recipient" DROP CONSTRAINT "FK_abuse_report_notification_recipient_systemWebhookId";
DROP INDEX "IDX_abuse_report_notification_recipient_isActive";
DROP INDEX "IDX_abuse_report_notification_recipient_method";
DROP INDEX "IDX_abuse_report_notification_recipient_userId";
DROP INDEX "IDX_abuse_report_notification_recipient_systemWebhookId";
DROP TABLE "abuse_report_notification_recipient";

DROP INDEX "IDX_system_webhook_isActive";
DROP INDEX "IDX_system_webhook_on";
DROP TABLE "system_webhook";
`);
}
}
Loading
Loading