summaryrefslogtreecommitdiff
path: root/packages/backend/src/core/NoteCreateService.ts
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2023-03-16 14:24:11 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2023-03-16 14:24:11 +0900
commit89e2c302dd0f41abb3f49700d63fb1f8cdf7e84a (patch)
tree7ab94563de1f978f840f846f6df1d9c22c08bfd5 /packages/backend/src/core/NoteCreateService.ts
parentupdate tabler-icons (diff)
downloadsharkey-89e2c302dd0f41abb3f49700d63fb1f8cdf7e84a.tar.gz
sharkey-89e2c302dd0f41abb3f49700d63fb1f8cdf7e84a.tar.bz2
sharkey-89e2c302dd0f41abb3f49700d63fb1f8cdf7e84a.zip
refactor(backend): integrate CreateNotificationService to NotificationService
Diffstat (limited to 'packages/backend/src/core/NoteCreateService.ts')
-rw-r--r--packages/backend/src/core/NoteCreateService.ts16
1 files changed, 8 insertions, 8 deletions
diff --git a/packages/backend/src/core/NoteCreateService.ts b/packages/backend/src/core/NoteCreateService.ts
index 5a4df69b62..2fc2a3d54f 100644
--- a/packages/backend/src/core/NoteCreateService.ts
+++ b/packages/backend/src/core/NoteCreateService.ts
@@ -30,7 +30,7 @@ import PerUserNotesChart from '@/core/chart/charts/per-user-notes.js';
import InstanceChart from '@/core/chart/charts/instance.js';
import ActiveUsersChart from '@/core/chart/charts/active-users.js';
import { GlobalEventService } from '@/core/GlobalEventService.js';
-import { CreateNotificationService } from '@/core/CreateNotificationService.js';
+import { NotificationService } from '@/core/NotificationService.js';
import { WebhookService } from '@/core/WebhookService.js';
import { HashtagService } from '@/core/HashtagService.js';
import { AntennaService } from '@/core/AntennaService.js';
@@ -60,7 +60,7 @@ class NotificationManager {
constructor(
private mutingsRepository: MutingsRepository,
- private createNotificationService: CreateNotificationService,
+ private notificationService: NotificationService,
notifier: { id: User['id']; },
note: Note,
) {
@@ -101,7 +101,7 @@ class NotificationManager {
// 通知される側のユーザーが通知する側のユーザーをミュートしていない限りは通知する
if (!mentioneesMutedUserIds.includes(this.notifier.id)) {
- this.createNotificationService.createNotification(x.target, x.reason, {
+ this.notificationService.createNotification(x.target, x.reason, {
notifierId: this.notifier.id,
noteId: this.note.id,
});
@@ -183,7 +183,7 @@ export class NoteCreateService implements OnApplicationShutdown {
private globalEventService: GlobalEventService,
private queueService: QueueService,
private noteReadService: NoteReadService,
- private createNotificationService: CreateNotificationService,
+ private notificationService: NotificationService,
private relayService: RelayService,
private federatedInstanceService: FederatedInstanceService,
private hashtagService: HashtagService,
@@ -198,7 +198,7 @@ export class NoteCreateService implements OnApplicationShutdown {
private perUserNotesChart: PerUserNotesChart,
private activeUsersChart: ActiveUsersChart,
private instanceChart: InstanceChart,
- ) {}
+ ) { }
@bindThis
public async create(user: {
@@ -391,7 +391,7 @@ export class NoteCreateService implements OnApplicationShutdown {
// 投稿を作成
try {
if (insert.hasPoll) {
- // Start transaction
+ // Start transaction
await this.db.transaction(async transactionalEntityManager => {
await transactionalEntityManager.insert(Note, insert);
@@ -414,7 +414,7 @@ export class NoteCreateService implements OnApplicationShutdown {
return insert;
} catch (e) {
- // duplicate key error
+ // duplicate key error
if (isDuplicateKeyValueError(e)) {
const err = new Error('Duplicated note');
err.name = 'duplicated';
@@ -558,7 +558,7 @@ export class NoteCreateService implements OnApplicationShutdown {
}
});
- const nm = new NotificationManager(this.mutingsRepository, this.createNotificationService, user, note);
+ const nm = new NotificationManager(this.mutingsRepository, this.notificationService, user, note);
await this.createMentionedEvents(mentionedUsers, note, nm);