lint
This commit is contained in:
		@@ -1,6 +1,6 @@
 | 
			
		||||
import { Inject, Injectable } from '@nestjs/common';
 | 
			
		||||
import { DI } from '@/di-symbols.js';
 | 
			
		||||
import type { NotesRepository, UsersRepository } from '@/models/index.js';
 | 
			
		||||
import { NotesRepository, UsersRepository } from '@/models/index.js';
 | 
			
		||||
import { IdentifiableError } from '@/misc/identifiable-error.js';
 | 
			
		||||
import type { User } from '@/models/entities/User.js';
 | 
			
		||||
import type { Note } from '@/models/entities/Note.js';
 | 
			
		||||
 
 | 
			
		||||
@@ -1,9 +1,6 @@
 | 
			
		||||
import rndstr from 'rndstr';
 | 
			
		||||
import { Note } from '@/models/entities/Note.js';
 | 
			
		||||
import { User } from '@/models/entities/User.js';
 | 
			
		||||
import { Notes, UserProfiles, NoteReactions } from '@/models/index.js';
 | 
			
		||||
import { generateMutedUserQuery } from './generate-muted-user-query.js';
 | 
			
		||||
import { generateBlockedUserQuery } from './generate-block-query.js';
 | 
			
		||||
import type { Note } from '@/models/entities/Note.js';
 | 
			
		||||
import type { User } from '@/models/entities/User.js';
 | 
			
		||||
 | 
			
		||||
// TODO: リアクション、Renote、返信などをしたノートは除外する
 | 
			
		||||
 | 
			
		||||
@@ -21,9 +18,9 @@ export async function injectFeatured(timeline: Note[], user?: User | null) {
 | 
			
		||||
	const query = Notes.createQueryBuilder('note')
 | 
			
		||||
		.addSelect('note.score')
 | 
			
		||||
		.where('note.userHost IS NULL')
 | 
			
		||||
		.andWhere(`note.score > 0`)
 | 
			
		||||
		.andWhere(`note.createdAt > :date`, { date: new Date(Date.now() - day) })
 | 
			
		||||
		.andWhere(`note.visibility = 'public'`)
 | 
			
		||||
		.andWhere('note.score > 0')
 | 
			
		||||
		.andWhere('note.createdAt > :date', { date: new Date(Date.now() - day) })
 | 
			
		||||
		.andWhere('note.visibility = \'public\'')
 | 
			
		||||
		.innerJoinAndSelect('note.user', 'user');
 | 
			
		||||
 | 
			
		||||
	if (user) {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,6 @@
 | 
			
		||||
import rndstr from 'rndstr';
 | 
			
		||||
import { Note } from '@/models/entities/Note.js';
 | 
			
		||||
import { User } from '@/models/entities/User.js';
 | 
			
		||||
import { PromoReads, PromoNotes, Notes, Users } from '@/models/index.js';
 | 
			
		||||
import type { Note } from '@/models/entities/Note.js';
 | 
			
		||||
import type { User } from '@/models/entities/User.js';
 | 
			
		||||
 | 
			
		||||
export async function injectPromo(timeline: Note[], user?: User | null) {
 | 
			
		||||
	if (timeline.length < 5) return;
 | 
			
		||||
 
 | 
			
		||||
@@ -25,7 +25,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
 | 
			
		||||
			const ep = endpoints.find(x => x.name === ps.endpoint);
 | 
			
		||||
			if (ep == null) return null;
 | 
			
		||||
			return {
 | 
			
		||||
				params: Object.entries(ep.params.properties || {}).map(([k, v]) => ({
 | 
			
		||||
				params: Object.entries(ep.params.properties ?? {}).map(([k, v]) => ({
 | 
			
		||||
					name: k,
 | 
			
		||||
					type: v.type.charAt(0).toUpperCase() + v.type.slice(1),
 | 
			
		||||
				})),
 | 
			
		||||
 
 | 
			
		||||
@@ -53,9 +53,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
 | 
			
		||||
 | 
			
		||||
			const mutedNotes = await this.notesRepository.find({
 | 
			
		||||
				where: [{
 | 
			
		||||
					id: note.threadId || note.id,
 | 
			
		||||
					id: note.threadId ?? note.id,
 | 
			
		||||
				}, {
 | 
			
		||||
					threadId: note.threadId || note.id,
 | 
			
		||||
					threadId: note.threadId ?? note.id,
 | 
			
		||||
				}],
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
@@ -64,7 +64,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
 | 
			
		||||
			await this.noteThreadMutingsRepository.insert({
 | 
			
		||||
				id: this.idService.genId(),
 | 
			
		||||
				createdAt: new Date(),
 | 
			
		||||
				threadId: note.threadId || note.id,
 | 
			
		||||
				threadId: note.threadId ?? note.id,
 | 
			
		||||
				userId: me.id,
 | 
			
		||||
			});
 | 
			
		||||
		});
 | 
			
		||||
 
 | 
			
		||||
@@ -45,7 +45,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
 | 
			
		||||
			});
 | 
			
		||||
 | 
			
		||||
			await this.noteThreadMutingsRepository.delete({
 | 
			
		||||
				threadId: note.threadId || note.id,
 | 
			
		||||
				threadId: note.threadId ?? note.id,
 | 
			
		||||
				userId: me.id,
 | 
			
		||||
			});
 | 
			
		||||
		});
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
import { refs, Schema } from '@/misc/schema.js';
 | 
			
		||||
import type { Schema } from '@/misc/schema.js';
 | 
			
		||||
import { refs } from '@/misc/schema.js';
 | 
			
		||||
 | 
			
		||||
export function convertSchemaToOpenApiSchema(schema: Schema) {
 | 
			
		||||
	const res: any = schema;
 | 
			
		||||
@@ -55,6 +56,6 @@ export const schemas = {
 | 
			
		||||
	},
 | 
			
		||||
 | 
			
		||||
	...Object.fromEntries(
 | 
			
		||||
		Object.entries(refs).map(([key, schema]) => [key, convertSchemaToOpenApiSchema(schema)])
 | 
			
		||||
		Object.entries(refs).map(([key, schema]) => [key, convertSchemaToOpenApiSchema(schema)]),
 | 
			
		||||
	),
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user