fix(backend): スレッドミュートがすでに設定されている場合のエラーハンドリングを追加 (#17838)

* fix(backend): スレッドミュートがすでに設定されている場合のエラーハンドリングを追加

* Update Changelog
This commit is contained in:
かっこかり
2026-08-02 17:19:54 +09:00
committed by GitHub
parent 3ce17c6e9f
commit 1853898d71
2 changed files with 16 additions and 6 deletions
+1 -1
View File
@@ -7,7 +7,7 @@
-
### Server
-
- Fix: 既にミュートしているスレッドに対して再度スレッドミュートを作成しようとするとサーバーエラーになる問題を修正
## 2026.7.0
@@ -30,6 +30,12 @@ export const meta = {
code: 'NO_SUCH_NOTE',
id: '5ff67ada-ed3b-2e71-8e87-a1a421e177d2',
},
alreadyMuting: {
message: 'You are already muting that thread.',
code: 'ALREADY_MUTING',
id: 'c146e22d-1141-4b31-b28d-176371014d18',
},
},
} as const;
@@ -59,14 +65,18 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
throw err;
});
const _mutedNotes = await this.notesRepository.find({
where: [{
id: note.threadId ?? note.id,
}, {
// Check if already muting
const exist = await this.noteThreadMutingsRepository.exists({
where: {
threadId: note.threadId ?? note.id,
}],
userId: me.id,
},
});
if (exist) {
throw new ApiError(meta.errors.alreadyMuting);
}
await this.noteThreadMutingsRepository.insert({
id: this.idService.gen(),
threadId: note.threadId ?? note.id,