This commit is contained in:
syuilo 2022-09-24 08:41:27 +09:00
parent b1abf47ce7
commit 6eace8894a
10 changed files with 20 additions and 15 deletions

View File

@ -20,7 +20,7 @@ export default class TestGroupedChart extends Chart<typeof schema> {
private db: DataSource,
private appLockService: AppLockService,
private logger: Logger,
logger: Logger,
) {
super(db, (k) => appLockService.getChartInsertLock(k), logger, name, schema, true);
}

View File

@ -18,7 +18,7 @@ export default class TestIntersectionChart extends Chart<typeof schema> {
private db: DataSource,
private appLockService: AppLockService,
private logger: Logger,
logger: Logger,
) {
super(db, (k) => appLockService.getChartInsertLock(k), logger, name, schema);
}

View File

@ -18,7 +18,7 @@ export default class TestUniqueChart extends Chart<typeof schema> {
private db: DataSource,
private appLockService: AppLockService,
private logger: Logger,
logger: Logger,
) {
super(db, (k) => appLockService.getChartInsertLock(k), logger, name, schema);
}

View File

@ -20,7 +20,7 @@ export default class TestChart extends Chart<typeof schema> {
private db: DataSource,
private appLockService: AppLockService,
private logger: Logger,
logger: Logger,
) {
super(db, (k) => appLockService.getChartInsertLock(k), logger, name, schema);
}

View File

@ -1,6 +1,6 @@
import { Inject, Injectable } from '@nestjs/common';
import { DI } from '@/di-symbols.js';
import type { GalleryPosts, GalleryLikesRepository } from '@/models/index.js';
import type { GalleryLikesRepository } from '@/models/index.js';
import { awaitAll } from '@/misc/prelude/await-all.js';
import type { Packed } from '@/misc/schema.js';
import type { } from '@/models/entities/Blocking.js';

View File

@ -295,8 +295,9 @@ export class ApInboxService {
let renote;
try {
renote = await this.apNoteService.resolveNote(targetUri);
if (renote == null) throw new Error('announce target is null');
} catch (err) {
// 対象が4xxならスキップ
// 対象が4xxならスキップ
if (err instanceof StatusError) {
if (err.isClientError) {
this.logger.warn(`Ignored announce target ${targetUri} - ${err.statusCode}`);
@ -308,7 +309,10 @@ export class ApInboxService {
throw err;
}
if (!await this.noteEntityService.isVisibleForMe(renote, actor.id)) return 'skip: invalid actor for this activity';
if (!await this.noteEntityService.isVisibleForMe(renote, actor.id)) {
this.logger.warn('skip: invalid actor for this activity');
return;
}
this.logger.info(`Creating the (Re)Note: ${uri}`);

View File

@ -243,7 +243,7 @@ export class ApRendererService {
};
}
public async renderLike(noteReaction: NoteReaction, note: Note) {
public async renderLike(noteReaction: NoteReaction, note: { uri: string | null }) {
const reaction = noteReaction.reaction;
const object = {

View File

@ -156,8 +156,8 @@ export class Resolver {
return this.notesRepository.findOneByOrFail({ id: parsed.id })
.then(note => {
if (parsed.rest === 'activity') {
// this refers to the create activity and not the note itself
return this.apRendererService.renderActivity(this.apRendererService.renderCreate(this.apRendererService.renderNote(note)));
// this refers to the create activity and not the note itself
return this.apRendererService.renderActivity(this.apRendererService.renderCreate(this.apRendererService.renderNote(note), note));
} else {
return this.apRendererService.renderNote(note);
}
@ -174,7 +174,7 @@ export class Resolver {
.then(([note, poll]) => this.apRendererService.renderQuestion({ id: note.userId }, note, poll));
case 'likes':
return this.noteReactionsRepository.findOneByOrFail({ id: parsed.id }).then(reaction =>
this.apRendererService.renderActivity(this.apRendererService.renderLike(reaction, { uri: null })));
this.apRendererService.renderActivity(this.apRendererService.renderLike(reaction, { uri: null }))!);
case 'follows':
// rest should be <followee id>
if (parsed.rest == null || !/^\w+$/.test(parsed.rest)) throw new Error('resolveLocal: invalid follow URI');
@ -184,7 +184,7 @@ export class Resolver {
)
.then(([follower, followee]) => this.apRendererService.renderActivity(this.apRendererService.renderFollow(follower, followee, url)));
default:
throw new Error(`resolveLocal: type ${type} unhandled`);
throw new Error(`resolveLocal: type ${parsed.type} unhandled`);
}
}
}

View File

@ -111,8 +111,9 @@ export interface IPost extends IObject {
mediaType: string;
};
_misskey_quote?: string;
_misskey_content?: string;
quoteUrl?: string;
_misskey_talk: boolean;
_misskey_talk?: boolean;
}
export interface IQuestion extends IObject {

View File

@ -725,10 +725,10 @@ export interface IEndpoint {
params: Schema;
}
const endpoints: IEndpoint[] = eps.map(([name, ep]) => {
const endpoints: IEndpoint[] = (eps as [string, any]).map(([name, ep]) => {
return {
name: name,
meta: ep.meta || {},
meta: ep.meta ?? {},
params: ep.paramDef,
};
});