fix
This commit is contained in:
parent
e9fda7dd1a
commit
588d6acfb7
|
@ -4,8 +4,10 @@
|
|||
*/
|
||||
|
||||
import { setImmediate } from 'node:timers/promises';
|
||||
import util from 'util';
|
||||
import { In, DataSource } from 'typeorm';
|
||||
import { Inject, Injectable, OnApplicationShutdown } from '@nestjs/common';
|
||||
import * as mfm from 'mfm-js';
|
||||
import type { IMentionedRemoteUsers } from '@/models/Note.js';
|
||||
import { MiNote } from '@/models/Note.js';
|
||||
import type { NotesRepository, UsersRepository } from '@/models/_.js';
|
||||
|
@ -20,14 +22,12 @@ import { ApDeliverManagerService } from '@/core/activitypub/ApDeliverManagerServ
|
|||
import { bindThis } from '@/decorators.js';
|
||||
import { DB_MAX_NOTE_TEXT_LENGTH } from '@/const.js';
|
||||
import { SearchService } from '@/core/SearchService.js';
|
||||
import { normalizeForSearch } from "@/misc/normalize-for-search.js";
|
||||
import { normalizeForSearch } from '@/misc/normalize-for-search.js';
|
||||
import { MiDriveFile } from '@/models/_.js';
|
||||
import { MiPoll, IPoll } from '@/models/Poll.js';
|
||||
import * as mfm from "cherrypick-mfm-js";
|
||||
import { concat } from "@/misc/prelude/array.js";
|
||||
import { extractHashtags } from "@/misc/extract-hashtags.js";
|
||||
import { extractCustomEmojisFromMfm } from "@/misc/extract-custom-emojis-from-mfm.js";
|
||||
import util from 'util';
|
||||
import { concat } from '@/misc/prelude/array.js';
|
||||
import { extractHashtags } from '@/misc/extract-hashtags.js';
|
||||
import { extractCustomEmojisFromMfm } from '@/misc/extract-custom-emojis-from-mfm.js';
|
||||
|
||||
type MinimumUser = {
|
||||
id: MiUser['id'];
|
||||
|
@ -187,10 +187,10 @@ export class NoteUpdateService implements OnApplicationShutdown {
|
|||
} else if (note.hasPoll && !values.hasPoll) {
|
||||
// Start transaction
|
||||
await this.db.transaction(async transactionalEntityManager => {
|
||||
await transactionalEntityManager.update(MiNote, {id: note.id}, values);
|
||||
await transactionalEntityManager.update(MiNote, { id: note.id }, values);
|
||||
|
||||
if (!values.hasPoll) {
|
||||
await transactionalEntityManager.delete(MiPoll, {noteId: note.id});
|
||||
await transactionalEntityManager.delete(MiPoll, { noteId: note.id });
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
|
|
@ -24,12 +24,11 @@ import { StatusError } from '@/misc/status-error.js';
|
|||
import { UtilityService } from '@/core/UtilityService.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { checkHttps } from '@/misc/check-https.js';
|
||||
import type { IObject, IPost } from '../type.js';
|
||||
import { NoteUpdateService } from '@/core/NoteUpdateService.js';
|
||||
import { getApId, getApType, getOneApHrefNullable, getOneApId, isEmoji, validPost } from '../type.js';
|
||||
import { ApLoggerService } from '../ApLoggerService.js';
|
||||
import { ApMfmService } from '../ApMfmService.js';
|
||||
import { ApDbResolverService } from '../ApDbResolverService.js';
|
||||
import type { Resolver } from '../ApResolverService.js';
|
||||
import { ApResolverService } from '../ApResolverService.js';
|
||||
import { ApAudienceService } from '../ApAudienceService.js';
|
||||
import { ApPersonService } from './ApPersonService.js';
|
||||
|
@ -37,7 +36,8 @@ import { extractApHashtags } from './tag.js';
|
|||
import { ApMentionService } from './ApMentionService.js';
|
||||
import { ApQuestionService } from './ApQuestionService.js';
|
||||
import { ApImageService } from './ApImageService.js';
|
||||
import { NoteUpdateService } from '@/core/NoteUpdateService.js';
|
||||
import type { Resolver } from '../ApResolverService.js';
|
||||
import type { IObject, IPost } from '../type.js';
|
||||
|
||||
@Injectable()
|
||||
export class ApNoteService {
|
||||
|
@ -53,9 +53,6 @@ export class ApNoteService {
|
|||
@Inject(DI.emojisRepository)
|
||||
private emojisRepository: EmojisRepository,
|
||||
|
||||
@Inject(DI.messagingMessagesRepository)
|
||||
private messagingMessagesRepository: MessagingMessagesRepository,
|
||||
|
||||
@Inject(DI.notesRepository)
|
||||
private notesRepository: NotesRepository,
|
||||
|
||||
|
@ -348,7 +345,7 @@ export class ApNoteService {
|
|||
}
|
||||
|
||||
const b_note = await this.notesRepository.findOneBy({
|
||||
uri: entryUri
|
||||
uri: entryUri,
|
||||
}).then(x => {
|
||||
if (x == null) throw new Error('note not found');
|
||||
return x;
|
||||
|
|
|
@ -13,7 +13,6 @@ import { DI } from '@/di-symbols.js';
|
|||
import { GetterService } from '@/server/api/GetterService.js';
|
||||
import { MAX_NOTE_TEXT_LENGTH } from '@/const.js';
|
||||
import { ApiError } from '../../error.js';
|
||||
import type { DriveFilesRepository, MiDriveFile } from "@/models/_.js";
|
||||
|
||||
export const meta = {
|
||||
tags: ['notes'],
|
||||
|
@ -116,9 +115,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
@Inject(DI.driveFilesRepository)
|
||||
private driveFilesRepository: DriveFilesRepository,
|
||||
|
||||
@Inject(DI.driveFilesRepository)
|
||||
private driveFilesRepository: DriveFilesRepository,
|
||||
|
||||
private getterService: GetterService,
|
||||
private noteEntityService: NoteEntityService,
|
||||
private noteUpdateService: NoteUpdateService,
|
||||
|
@ -133,7 +129,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
throw new ApiError(meta.errors.noSuchNote);
|
||||
}
|
||||
|
||||
|
||||
let files: MiDriveFile[] = [];
|
||||
const fileIds = ps.fileIds ?? ps.mediaIds ?? null;
|
||||
if (fileIds != null) {
|
||||
|
|
Loading…
Reference in New Issue