fix: thread muting
This commit is contained in:
parent
64aaff1f3d
commit
3f43f3d801
1 changed files with 14 additions and 11 deletions
|
@ -4,6 +4,7 @@ import readNote from "@/services/note/read.js";
|
|||
import define from "../../../define.js";
|
||||
import { getNote } from "../../../common/getters.js";
|
||||
import { ApiError } from "../../../error.js";
|
||||
import { scyllaClient } from "@/db/scylla.js";
|
||||
|
||||
export const meta = {
|
||||
tags: ["notes"],
|
||||
|
@ -36,18 +37,20 @@ export default define(meta, paramDef, async (ps, user) => {
|
|||
throw err;
|
||||
});
|
||||
|
||||
const mutedNotes = await Notes.find({
|
||||
where: [
|
||||
{
|
||||
id: note.threadId || note.id,
|
||||
},
|
||||
{
|
||||
threadId: note.threadId || note.id,
|
||||
},
|
||||
],
|
||||
});
|
||||
if (!scyllaClient) {
|
||||
const mutedNotes = await Notes.find({
|
||||
where: [
|
||||
{
|
||||
id: note.threadId || note.id,
|
||||
},
|
||||
{
|
||||
threadId: note.threadId || note.id,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
await readNote(user.id, mutedNotes);
|
||||
await readNote(user.id, mutedNotes);
|
||||
}
|
||||
|
||||
await NoteThreadMutings.insert({
|
||||
id: genId(),
|
||||
|
|
Loading…
Reference in a new issue