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 db: DataSource,
private appLockService: AppLockService, private appLockService: AppLockService,
private logger: Logger, logger: Logger,
) { ) {
super(db, (k) => appLockService.getChartInsertLock(k), logger, name, schema, true); 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 db: DataSource,
private appLockService: AppLockService, private appLockService: AppLockService,
private logger: Logger, logger: Logger,
) { ) {
super(db, (k) => appLockService.getChartInsertLock(k), logger, name, schema); 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 db: DataSource,
private appLockService: AppLockService, private appLockService: AppLockService,
private logger: Logger, logger: Logger,
) { ) {
super(db, (k) => appLockService.getChartInsertLock(k), logger, name, schema); 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 db: DataSource,
private appLockService: AppLockService, private appLockService: AppLockService,
private logger: Logger, logger: Logger,
) { ) {
super(db, (k) => appLockService.getChartInsertLock(k), logger, name, schema); super(db, (k) => appLockService.getChartInsertLock(k), logger, name, schema);
} }

View file

@ -1,6 +1,6 @@
import { Inject, Injectable } from '@nestjs/common'; import { Inject, Injectable } from '@nestjs/common';
import { DI } from '@/di-symbols.js'; 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 { awaitAll } from '@/misc/prelude/await-all.js';
import type { Packed } from '@/misc/schema.js'; import type { Packed } from '@/misc/schema.js';
import type { } from '@/models/entities/Blocking.js'; import type { } from '@/models/entities/Blocking.js';

View file

@ -295,8 +295,9 @@ export class ApInboxService {
let renote; let renote;
try { try {
renote = await this.apNoteService.resolveNote(targetUri); renote = await this.apNoteService.resolveNote(targetUri);
if (renote == null) throw new Error('announce target is null');
} catch (err) { } catch (err) {
// 対象が4xxならスキップ // 対象が4xxならスキップ
if (err instanceof StatusError) { if (err instanceof StatusError) {
if (err.isClientError) { if (err.isClientError) {
this.logger.warn(`Ignored announce target ${targetUri} - ${err.statusCode}`); this.logger.warn(`Ignored announce target ${targetUri} - ${err.statusCode}`);
@ -308,7 +309,10 @@ export class ApInboxService {
throw err; 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}`); 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 reaction = noteReaction.reaction;
const object = { const object = {

View file

@ -156,8 +156,8 @@ export class Resolver {
return this.notesRepository.findOneByOrFail({ id: parsed.id }) return this.notesRepository.findOneByOrFail({ id: parsed.id })
.then(note => { .then(note => {
if (parsed.rest === 'activity') { if (parsed.rest === 'activity') {
// this refers to the create activity and not the note itself // this refers to the create activity and not the note itself
return this.apRendererService.renderActivity(this.apRendererService.renderCreate(this.apRendererService.renderNote(note))); return this.apRendererService.renderActivity(this.apRendererService.renderCreate(this.apRendererService.renderNote(note), note));
} else { } else {
return this.apRendererService.renderNote(note); return this.apRendererService.renderNote(note);
} }
@ -174,7 +174,7 @@ export class Resolver {
.then(([note, poll]) => this.apRendererService.renderQuestion({ id: note.userId }, note, poll)); .then(([note, poll]) => this.apRendererService.renderQuestion({ id: note.userId }, note, poll));
case 'likes': case 'likes':
return this.noteReactionsRepository.findOneByOrFail({ id: parsed.id }).then(reaction => 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': case 'follows':
// rest should be <followee id> // rest should be <followee id>
if (parsed.rest == null || !/^\w+$/.test(parsed.rest)) throw new Error('resolveLocal: invalid follow URI'); 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))); .then(([follower, followee]) => this.apRendererService.renderActivity(this.apRendererService.renderFollow(follower, followee, url)));
default: 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; mediaType: string;
}; };
_misskey_quote?: string; _misskey_quote?: string;
_misskey_content?: string;
quoteUrl?: string; quoteUrl?: string;
_misskey_talk: boolean; _misskey_talk?: boolean;
} }
export interface IQuestion extends IObject { export interface IQuestion extends IObject {

View file

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