mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-08-02 13:26:07 +00:00
fix(backend): スレッドミュートがすでに設定されている場合のエラーハンドリングを追加 (#17838)
* fix(backend): スレッドミュートがすでに設定されている場合のエラーハンドリングを追加 * Update Changelog
This commit is contained in:
+1
-1
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user