From ff67ee0586a74943cd6b43d8d36853b365269fb8 Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Sat, 25 May 2024 18:32:10 +0900 Subject: [PATCH 1/5] feat(backend): mark an file as sensitive if the file was newly federated as sensitive --- packages/backend/src/core/DriveService.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/backend/src/core/DriveService.ts b/packages/backend/src/core/DriveService.ts index 1bc1df1dda4c..8eac6058b729 100644 --- a/packages/backend/src/core/DriveService.ts +++ b/packages/backend/src/core/DriveService.ts @@ -504,6 +504,11 @@ export class DriveService { if (much) { this.registerLogger.info(`file with same hash is found: ${much.id}`); + if (sensitive && !much.isSensitive) { + // The file is federated as sensitive for this time, but the file is federated as non-sensitive before. + // Therefore, update the file to sensitive. + await this.updateFile(much, { isSensitive: true }, user); + } return much; } } From 24424adea0b1d66129dcc5e587f4829391ab4d46 Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Sat, 25 May 2024 18:34:21 +0900 Subject: [PATCH 2/5] =?UTF-8?q?docs(changelog):=20=E3=82=82=E3=81=A8?= =?UTF-8?q?=E3=82=82=E3=81=A8=E3=82=BB=E3=83=B3=E3=82=B7=E3=83=86=E3=82=A3?= =?UTF-8?q?=E3=83=96=E3=81=A7=E3=81=AF=E3=81=AA=E3=81=84=E3=81=A8=E9=80=A3?= =?UTF-8?q?=E5=90=88=E3=81=95=E3=82=8C=E3=81=A6=E3=81=84=E3=81=9F=E3=83=95?= =?UTF-8?q?=E3=82=A1=E3=82=A4=E3=83=AB=E3=81=8C=E3=82=BB=E3=83=B3=E3=82=B7?= =?UTF-8?q?=E3=83=86=E3=82=A3=E3=83=96=E3=81=A8=E3=81=97=E3=81=A6=E9=80=A3?= =?UTF-8?q?=E5=90=88=E3=81=95=E3=82=8C=E3=81=9F=E5=A0=B4=E5=90=88=E3=81=AB?= =?UTF-8?q?=E3=82=BB=E3=83=B3=E3=82=B7=E3=83=86=E3=82=A3=E3=83=96=E3=81=A8?= =?UTF-8?q?=E3=81=97=E3=81=A6=E3=81=9D=E3=81=AE=E3=83=95=E3=82=A1=E3=82=A4?= =?UTF-8?q?=E3=83=AB=E3=82=92=E6=89=B1=E3=81=86=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 681903a1f2ba..3c0e7298855e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -92,6 +92,8 @@ - Fix: `/i/notifications`に `includeTypes`か`excludeTypes`を指定しているとき、通知が存在するのに空配列を返すことがある問題を修正 - Fix: 複数idを指定する`users/show`が関係ないユーザを返すことがある問題を修正 - Fix: `/tags` と `/user-tags` が検索エンジンにインデックスされないように +- Fix: もともとセンシティブではないと連合されていたファイルがセンシティブとして連合された場合にセンシティブとしてそのファイルを扱うように + - センシティブとして連合したファイルは非センシティブとして連合されてもセンシティブとして扱われます ## 2024.3.1 From e1e1b8c27932640ab4d5d7da68079378f75ac37f Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Sat, 25 May 2024 18:50:07 +0900 Subject: [PATCH 3/5] fix: change way to update federated image --- packages/backend/src/core/DriveService.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/backend/src/core/DriveService.ts b/packages/backend/src/core/DriveService.ts index 8eac6058b729..3c423326ebcb 100644 --- a/packages/backend/src/core/DriveService.ts +++ b/packages/backend/src/core/DriveService.ts @@ -507,7 +507,7 @@ export class DriveService { if (sensitive && !much.isSensitive) { // The file is federated as sensitive for this time, but the file is federated as non-sensitive before. // Therefore, update the file to sensitive. - await this.updateFile(much, { isSensitive: true }, user); + await this.driveFilesRepository.update({ id: much.id }, { isSensitive: true }); } return much; } From 5b4b73ac7969c3640b9c901bb23512055f3c1eb6 Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Sat, 25 May 2024 20:40:28 +0900 Subject: [PATCH 4/5] Update packages/backend/src/core/DriveService.ts Co-authored-by: Sayamame-beans <61457993+Sayamame-beans@users.noreply.github.com> --- packages/backend/src/core/DriveService.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/backend/src/core/DriveService.ts b/packages/backend/src/core/DriveService.ts index 3c423326ebcb..39f7cb30beda 100644 --- a/packages/backend/src/core/DriveService.ts +++ b/packages/backend/src/core/DriveService.ts @@ -505,7 +505,7 @@ export class DriveService { if (much) { this.registerLogger.info(`file with same hash is found: ${much.id}`); if (sensitive && !much.isSensitive) { - // The file is federated as sensitive for this time, but the file is federated as non-sensitive before. + // The file is federated as sensitive for this time, but was federated as non-sensitive before. // Therefore, update the file to sensitive. await this.driveFilesRepository.update({ id: much.id }, { isSensitive: true }); } From 320d0202a529133b717131cd5f469d64b4fdd1a0 Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Mon, 27 May 2024 18:04:44 +0900 Subject: [PATCH 5/5] update isSensitive of existing record object --- packages/backend/src/core/DriveService.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/backend/src/core/DriveService.ts b/packages/backend/src/core/DriveService.ts index 39f7cb30beda..63fa26f69d5c 100644 --- a/packages/backend/src/core/DriveService.ts +++ b/packages/backend/src/core/DriveService.ts @@ -508,6 +508,7 @@ export class DriveService { // The file is federated as sensitive for this time, but was federated as non-sensitive before. // Therefore, update the file to sensitive. await this.driveFilesRepository.update({ id: much.id }, { isSensitive: true }); + much.isSensitive = true; } return much; }