delete from other tables
This commit is contained in:
parent
0e727d3f7b
commit
7cacefdd99
1 changed files with 45 additions and 2 deletions
|
@ -8,7 +8,20 @@ import renderTombstone from "@/remote/activitypub/renderer/tombstone.js";
|
|||
import config from "@/config/index.js";
|
||||
import type { User, ILocalUser, IRemoteUser } from "@/models/entities/user.js";
|
||||
import type { Note, IMentionedRemoteUsers } from "@/models/entities/note.js";
|
||||
import { Notes, Users, Instances } from "@/models/index.js";
|
||||
import {
|
||||
Notes,
|
||||
Users,
|
||||
Instances,
|
||||
UserNotePinings,
|
||||
ClipNotes,
|
||||
NoteFavorites,
|
||||
ChannelNotePinings,
|
||||
MutedNotes,
|
||||
NoteWatchings,
|
||||
PromoNotes,
|
||||
NoteUnreads,
|
||||
PromoReads,
|
||||
} from "@/models/index.js";
|
||||
import {
|
||||
notesChart,
|
||||
perUserNotesChart,
|
||||
|
@ -28,7 +41,6 @@ import {
|
|||
prepared,
|
||||
scyllaClient,
|
||||
} from "@/db/scylla.js";
|
||||
import { LocalFollowersCache } from "@/misc/cache.js";
|
||||
|
||||
/**
|
||||
* Delete a post
|
||||
|
@ -275,6 +287,37 @@ export default async function (
|
|||
prepare: true,
|
||||
});
|
||||
}
|
||||
|
||||
const noteIdsToDelete = notesToDelete.map(({ id }) => id);
|
||||
await Promise.all([
|
||||
ChannelNotePinings.delete({
|
||||
noteId: In(noteIdsToDelete),
|
||||
}),
|
||||
ClipNotes.delete({
|
||||
noteId: In(noteIdsToDelete),
|
||||
}),
|
||||
MutedNotes.delete({
|
||||
noteId: In(noteIdsToDelete),
|
||||
}),
|
||||
NoteFavorites.delete({
|
||||
noteId: In(noteIdsToDelete),
|
||||
}),
|
||||
NoteUnreads.delete({
|
||||
noteId: In(noteIdsToDelete),
|
||||
}),
|
||||
NoteWatchings.delete({
|
||||
noteId: In(noteIdsToDelete),
|
||||
}),
|
||||
PromoNotes.delete({
|
||||
noteId: In(noteIdsToDelete),
|
||||
}),
|
||||
PromoReads.delete({
|
||||
noteId: In(noteIdsToDelete),
|
||||
}),
|
||||
UserNotePinings.delete({
|
||||
noteId: In(noteIdsToDelete),
|
||||
}),
|
||||
]);
|
||||
} else {
|
||||
await Notes.delete({
|
||||
id: note.id,
|
||||
|
|
Loading…
Reference in a new issue