refactor: fix types

This commit is contained in:
syuilo 2023-02-17 15:15:36 +09:00
parent bde22208fe
commit 0e1b5d6f14
4 changed files with 5 additions and 7 deletions

View file

@ -5,9 +5,9 @@ import type { NotificationsRepository } from '@/models/index.js';
import type { User } from '@/models/entities/User.js'; import type { User } from '@/models/entities/User.js';
import type { Notification } from '@/models/entities/Notification.js'; import type { Notification } from '@/models/entities/Notification.js';
import { UserEntityService } from '@/core/entities/UserEntityService.js'; import { UserEntityService } from '@/core/entities/UserEntityService.js';
import { bindThis } from '@/decorators.js';
import { GlobalEventService } from './GlobalEventService.js'; import { GlobalEventService } from './GlobalEventService.js';
import { PushNotificationService } from './PushNotificationService.js'; import { PushNotificationService } from './PushNotificationService.js';
import { bindThis } from '@/decorators.js';
@Injectable() @Injectable()
export class NotificationService { export class NotificationService {
@ -65,7 +65,6 @@ export class NotificationService {
@bindThis @bindThis
private postReadNotifications(userId: User['id'], notificationIds: Notification['id'][]) { private postReadNotifications(userId: User['id'], notificationIds: Notification['id'][]) {
this.globalEventService.publishMainStream(userId, 'readNotifications', notificationIds);
return this.pushNotificationService.pushNotification(userId, 'readNotifications', { notificationIds }); return this.pushNotificationService.pushNotification(userId, 'readNotifications', { notificationIds });
} }
} }

View file

@ -178,9 +178,8 @@ export class ApRendererService {
} }
// to anonymise reporters, the reporting actor must be a system user // to anonymise reporters, the reporting actor must be a system user
// object has to be a uri or array of uris
@bindThis @bindThis
public renderFlag(user: LocalUser, object: IObject | string | string[], content: string): IFlag { public renderFlag(user: LocalUser, object: IObject | string, content: string): IFlag {
return { return {
type: 'Flag', type: 'Flag',
actor: `${this.config.url}/users/${user.id}`, actor: `${this.config.url}/users/${user.id}`,

File diff suppressed because one or more lines are too long

View file

@ -49,7 +49,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
const actor = await this.instanceActorService.getInstanceActor(); const actor = await this.instanceActorService.getInstanceActor();
const targetUser = await this.usersRepository.findOneByOrFail({ id: report.targetUserId }); const targetUser = await this.usersRepository.findOneByOrFail({ id: report.targetUserId });
this.queueService.deliver(actor, this.apRendererService.addContext(this.apRendererService.renderFlag(actor, [targetUser.uri!], report.comment)), targetUser.inbox); this.queueService.deliver(actor, this.apRendererService.addContext(this.apRendererService.renderFlag(actor, targetUser.uri!, report.comment)), targetUser.inbox);
} }
await this.abuseUserReportsRepository.update(report.id, { await this.abuseUserReportsRepository.update(report.id, {