refactor: fix type

This commit is contained in:
syuilo 2023-02-01 17:29:28 +09:00
parent ebc6437977
commit 387fcd5c5d
5 changed files with 6 additions and 12 deletions

View file

@ -9,9 +9,9 @@ import { IdService } from '@/core/IdService.js';
import { GlobalEventService } from '@/core/GlobalEventService.js'; import { GlobalEventService } from '@/core/GlobalEventService.js';
import type { UsersRepository, NoteUnreadsRepository, MutingsRepository, NoteThreadMutingsRepository, FollowingsRepository, ChannelFollowingsRepository, AntennaNotesRepository } from '@/models/index.js'; import type { UsersRepository, NoteUnreadsRepository, MutingsRepository, NoteThreadMutingsRepository, FollowingsRepository, ChannelFollowingsRepository, AntennaNotesRepository } from '@/models/index.js';
import { UserEntityService } from '@/core/entities/UserEntityService.js'; import { UserEntityService } from '@/core/entities/UserEntityService.js';
import { bindThis } from '@/decorators.js';
import { NotificationService } from './NotificationService.js'; import { NotificationService } from './NotificationService.js';
import { AntennaService } from './AntennaService.js'; import { AntennaService } from './AntennaService.js';
import { bindThis } from '@/decorators.js';
import { PushNotificationService } from './PushNotificationService.js'; import { PushNotificationService } from './PushNotificationService.js';
@Injectable() @Injectable()
@ -107,12 +107,6 @@ export class NoteReadService {
followingChannels: Set<Channel['id']>; followingChannels: Set<Channel['id']>;
}, },
): Promise<void> { ): Promise<void> {
const following = info?.following ? info.following : new Set<string>((await this.followingsRepository.find({
where: {
followerId: userId,
},
select: ['followeeId'],
})).map(x => x.followeeId));
const followingChannels = info?.followingChannels ? info.followingChannels : new Set<string>((await this.channelFollowingsRepository.find({ const followingChannels = info?.followingChannels ? info.followingChannels : new Set<string>((await this.channelFollowingsRepository.find({
where: { where: {
followerId: userId, followerId: userId,
@ -139,7 +133,7 @@ export class NoteReadService {
if (note.user != null) { // たぶんnullになることは無いはずだけど一応 if (note.user != null) { // たぶんnullになることは無いはずだけど一応
for (const antenna of myAntennas) { for (const antenna of myAntennas) {
if (await this.antennaService.checkHitAntenna(antenna, note, note.user, undefined, Array.from(following))) { if (await this.antennaService.checkHitAntenna(antenna, note, note.user)) {
readAntennaNotes.push(note); readAntennaNotes.push(note);
} }
} }

View file

@ -4,7 +4,7 @@ import { unique } from '@/misc/prelude/array.js';
export function extractCustomEmojisFromMfm(nodes: mfm.MfmNode[]): string[] { export function extractCustomEmojisFromMfm(nodes: mfm.MfmNode[]): string[] {
const emojiNodes = mfm.extract(nodes, (node) => { const emojiNodes = mfm.extract(nodes, (node) => {
return (node.type === 'emojiCode' && node.props.name.length <= 100); return (node.type === 'emojiCode' && node.props.name.length <= 100);
}); }) as mfm.MfmEmojiCode[];
return unique(emojiNodes.map(x => x.props.name)); return unique(emojiNodes.map(x => x.props.name));
} }

View file

@ -2,7 +2,7 @@ import * as mfm from 'mfm-js';
import { unique } from '@/misc/prelude/array.js'; import { unique } from '@/misc/prelude/array.js';
export function extractHashtags(nodes: mfm.MfmNode[]): string[] { export function extractHashtags(nodes: mfm.MfmNode[]): string[] {
const hashtagNodes = mfm.extract(nodes, (node) => node.type === 'hashtag'); const hashtagNodes = mfm.extract(nodes, (node) => node.type === 'hashtag') as mfm.MfmHashtag[];
const hashtags = unique(hashtagNodes.map(x => x.props.hashtag)); const hashtags = unique(hashtagNodes.map(x => x.props.hashtag));
return hashtags; return hashtags;

View file

@ -134,7 +134,7 @@ export class DiscordServerService {
reply.redirect(oauth2!.getAuthorizeUrl(params)); reply.redirect(oauth2!.getAuthorizeUrl(params));
}); });
fastify.get('/dc/cb', async (request, reply) => { fastify.get<{ Querystring: { code: string; state: string; } }>('/dc/cb', async (request, reply) => {
const userToken = this.getUserToken(request); const userToken = this.getUserToken(request);
const oauth2 = await getOAuth2(); const oauth2 = await getOAuth2();

View file

@ -132,7 +132,7 @@ export class GithubServerService {
reply.redirect(oauth2!.getAuthorizeUrl(params)); reply.redirect(oauth2!.getAuthorizeUrl(params));
}); });
fastify.get('/gh/cb', async (request, reply) => { fastify.get<{ Querystring: { code: string; state: string; } }>('/gh/cb', async (request, reply) => {
const userToken = this.getUserToken(request); const userToken = this.getUserToken(request);
const oauth2 = await getOath2(); const oauth2 = await getOath2();