summaryrefslogtreecommitdiff
path: root/packages/backend/src/core/NoteDeleteService.ts
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2023-08-16 17:51:28 +0900
committerGitHub <noreply@github.com>2023-08-16 17:51:28 +0900
commit792622aeadf3e36d50cddec3c64b2ff0105ea927 (patch)
treec42a71da86be3c33e2752b4c673e280b1158e57b /packages/backend/src/core/NoteDeleteService.ts
parentbuild(deps): bump actions/setup-node from 3.7.0 to 3.8.0 (#11726) (diff)
downloadsharkey-792622aeadf3e36d50cddec3c64b2ff0105ea927.tar.gz
sharkey-792622aeadf3e36d50cddec3c64b2ff0105ea927.tar.bz2
sharkey-792622aeadf3e36d50cddec3c64b2ff0105ea927.zip
refactor: prefix Mi for all entities (#11719)
* wip * wip * wip * wip * Update RepositoryModule.ts * wip * wip * wip * Revert "wip" This reverts commit c1c13b37d2aaf3c65bc148212da302b0eb7868bf.
Diffstat (limited to 'packages/backend/src/core/NoteDeleteService.ts')
-rw-r--r--packages/backend/src/core/NoteDeleteService.ts20
1 files changed, 10 insertions, 10 deletions
diff --git a/packages/backend/src/core/NoteDeleteService.ts b/packages/backend/src/core/NoteDeleteService.ts
index 7a44916f5e..07708bd028 100644
--- a/packages/backend/src/core/NoteDeleteService.ts
+++ b/packages/backend/src/core/NoteDeleteService.ts
@@ -5,8 +5,8 @@
import { Brackets, In } from 'typeorm';
import { Injectable, Inject } from '@nestjs/common';
-import type { User, LocalUser, RemoteUser } from '@/models/entities/User.js';
-import type { Note, IMentionedRemoteUsers } from '@/models/entities/Note.js';
+import type { MiUser, MiLocalUser, MiRemoteUser } from '@/models/entities/User.js';
+import type { MiNote, IMentionedRemoteUsers } from '@/models/entities/Note.js';
import type { InstancesRepository, NotesRepository, UsersRepository } from '@/models/index.js';
import { RelayService } from '@/core/RelayService.js';
import { FederatedInstanceService } from '@/core/FederatedInstanceService.js';
@@ -58,7 +58,7 @@ export class NoteDeleteService {
* @param user 投稿者
* @param note 投稿
*/
- async delete(user: { id: User['id']; uri: User['uri']; host: User['host']; isBot: User['isBot']; }, note: Note, quiet = false) {
+ async delete(user: { id: MiUser['id']; uri: MiUser['uri']; host: MiUser['host']; isBot: MiUser['isBot']; }, note: MiNote, quiet = false) {
const deletedAt = new Date();
const cascadingNotes = await this.findCascadingNotes(note);
@@ -79,7 +79,7 @@ export class NoteDeleteService {
//#region ローカルの投稿なら削除アクティビティを配送
if (this.userEntityService.isLocalUser(user) && !note.localOnly) {
- let renote: Note | null = null;
+ let renote: MiNote | null = null;
// if deletd note is renote
if (note.renoteId && note.text == null && !note.hasPoll && (note.fileIds == null || note.fileIds.length === 0)) {
@@ -134,8 +134,8 @@ export class NoteDeleteService {
}
@bindThis
- private async findCascadingNotes(note: Note): Promise<Note[]> {
- const recursive = async (noteId: string): Promise<Note[]> => {
+ private async findCascadingNotes(note: MiNote): Promise<MiNote[]> {
+ const recursive = async (noteId: string): Promise<MiNote[]> => {
const query = this.notesRepository.createQueryBuilder('note')
.where('note.replyId = :noteId', { noteId })
.orWhere(new Brackets(q => {
@@ -151,13 +151,13 @@ export class NoteDeleteService {
].flat();
};
- const cascadingNotes: Note[] = await recursive(note.id);
+ const cascadingNotes: MiNote[] = await recursive(note.id);
return cascadingNotes;
}
@bindThis
- private async getMentionedRemoteUsers(note: Note) {
+ private async getMentionedRemoteUsers(note: MiNote) {
const where = [] as any[];
// mention / reply / dm
@@ -179,11 +179,11 @@ export class NoteDeleteService {
return await this.usersRepository.find({
where,
- }) as RemoteUser[];
+ }) as MiRemoteUser[];
}
@bindThis
- private async deliverToConcerned(user: { id: LocalUser['id']; host: null; }, note: Note, content: any) {
+ private async deliverToConcerned(user: { id: MiLocalUser['id']; host: null; }, note: MiNote, content: any) {
this.apDeliverManagerService.deliverToFollowers(user, content);
this.relayService.deliverToRelays(user, content);
const remoteUsers = await this.getMentionedRemoteUsers(note);