mirror of
https://github.com/paricafe/misskey.git
synced 2024-11-28 06:06:43 -06:00
fix(edit): add missing updated
field
This commit is contained in:
parent
70a1c308f0
commit
678aa493de
5 changed files with 11 additions and 8 deletions
|
@ -3,11 +3,10 @@
|
|||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { Brackets, In } from 'typeorm';
|
||||
import { Injectable, Inject } from '@nestjs/common';
|
||||
import * as mfm from 'mfm-js';
|
||||
import type { MiUser, MiLocalUser, MiRemoteUser } from '@/models/User.js';
|
||||
import type { MiNote, IMentionedRemoteUsers } from '@/models/Note.js';
|
||||
import type { MiNote } from '@/models/Note.js';
|
||||
import type { InstancesRepository, NotesRepository, UsersRepository } from '@/models/_.js';
|
||||
import { RelayService } from '@/core/RelayService.js';
|
||||
import { FederatedInstanceService } from '@/core/FederatedInstanceService.js';
|
||||
|
@ -68,7 +67,7 @@ export class NoteUpdateService {
|
|||
* @param note Note to update
|
||||
* @param ps New note info
|
||||
*/
|
||||
async update(user: { id: MiUser['id']; uri: MiUser['uri']; host: MiUser['host']; isBot: MiUser['isBot']; }, note: MiNote, ps: Pick<MiNote, 'text' | 'cw'>, quiet = false, updater?: MiUser) {
|
||||
async update(user: { id: MiUser['id']; uri: MiUser['uri']; host: MiUser['host']; isBot: MiUser['isBot']; }, note: MiNote, ps: Pick<MiNote, 'text' | 'cw' | 'updatedAt'>, quiet = false, updater?: MiUser) {
|
||||
const newNote = {
|
||||
...note,
|
||||
...ps, // Overwrite updated fields
|
||||
|
@ -94,7 +93,7 @@ export class NoteUpdateService {
|
|||
this.searchService.indexNote(newNote);
|
||||
|
||||
await this.notesRepository.update({ id: note.id }, {
|
||||
updatedAt: new Date(),
|
||||
updatedAt: ps.updatedAt,
|
||||
history: [...(note.history || []), {
|
||||
createdAt: (note.updatedAt || this.idService.parse(note.id).date).toISOString(),
|
||||
cw: note.cw,
|
||||
|
|
|
@ -425,6 +425,7 @@ export class ApRendererService {
|
|||
return {
|
||||
id: `${this.config.url}/notes/${note.id}`,
|
||||
type: 'Note',
|
||||
updated: note.updatedAt ?? undefined,
|
||||
attributedTo,
|
||||
summary: summary ?? undefined,
|
||||
content: content ?? undefined,
|
||||
|
|
|
@ -363,9 +363,12 @@ export class ApNoteService {
|
|||
text = this.apMfmService.htmlToMfm(note.content, note.tag);
|
||||
}
|
||||
|
||||
const updatedAt = note.updated || new Date();
|
||||
|
||||
await this.noteUpdateService.update(actor, originNote, {
|
||||
cw,
|
||||
text,
|
||||
updatedAt,
|
||||
}, silent);
|
||||
}
|
||||
|
||||
|
|
|
@ -127,6 +127,7 @@ export interface IPost extends IObject {
|
|||
_misskey_quote?: string;
|
||||
_misskey_content?: string;
|
||||
quoteUrl?: string;
|
||||
updated?: Date;
|
||||
}
|
||||
|
||||
export interface IQuestion extends IObject {
|
||||
|
|
|
@ -5,14 +5,12 @@
|
|||
|
||||
import ms from 'ms';
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import type { UsersRepository, NotesRepository } from '@/models/_.js';
|
||||
import type { UsersRepository } from '@/models/_.js';
|
||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import { GetterService } from '@/server/api/GetterService.js';
|
||||
import { GlobalEventService } from '@/core/GlobalEventService.js';
|
||||
import { MAX_NOTE_TEXT_LENGTH } from '@/const.js';
|
||||
import { ApiError } from '../../error.js';
|
||||
import { IdService } from "@/core/IdService.js";
|
||||
import { ApiError } from '@/server/api/error.js';
|
||||
import { NoteUpdateService } from '@/core/NoteUpdateService.js';
|
||||
|
||||
export const meta = {
|
||||
|
@ -75,6 +73,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
await this.noteUpdateService.update(await this.usersRepository.findOneByOrFail({ id: note.userId }), note, {
|
||||
text: ps.text,
|
||||
cw: ps.cw,
|
||||
updatedAt: new Date(),
|
||||
}, false, me);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue