mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-07-07 20:44:34 +00:00
Make NoteEdit entity match the database schema
This commit is contained in:
parent
353728929e
commit
8957cd9f3e
3 changed files with 9 additions and 10 deletions
|
@ -26,11 +26,6 @@ export class NoteEdit {
|
||||||
@JoinColumn()
|
@JoinColumn()
|
||||||
public note: MiNote | null;
|
public note: MiNote | null;
|
||||||
|
|
||||||
@Column('text', {
|
|
||||||
nullable: true,
|
|
||||||
})
|
|
||||||
public oldText: string | null;
|
|
||||||
|
|
||||||
@Column('text', {
|
@Column('text', {
|
||||||
nullable: true,
|
nullable: true,
|
||||||
})
|
})
|
||||||
|
@ -54,8 +49,14 @@ export class NoteEdit {
|
||||||
})
|
})
|
||||||
public updatedAt: Date;
|
public updatedAt: Date;
|
||||||
|
|
||||||
|
@Column('text', {
|
||||||
|
nullable: true,
|
||||||
|
})
|
||||||
|
public oldText: string | null;
|
||||||
|
|
||||||
@Column('timestamp with time zone', {
|
@Column('timestamp with time zone', {
|
||||||
comment: 'The old date from before the edit',
|
comment: 'The old date from before the edit',
|
||||||
|
nullable: true,
|
||||||
})
|
})
|
||||||
public oldDate: Date;
|
public oldDate: Date | null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,7 +106,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
|
|
||||||
for (const edit of edits) {
|
for (const edit of edits) {
|
||||||
editArray.push({
|
editArray.push({
|
||||||
oldDate: edit.oldDate.toISOString(),
|
oldDate: (edit.oldDate ?? edit.updatedAt).toISOString(),
|
||||||
updatedAt: edit.updatedAt.toISOString(),
|
updatedAt: edit.updatedAt.toISOString(),
|
||||||
text: edit.oldText ?? edit.newText ?? null,
|
text: edit.oldText ?? edit.newText ?? null,
|
||||||
});
|
});
|
||||||
|
|
|
@ -45,11 +45,9 @@ export async function getNoteVersionsMenu(props: { note: Misskey.entities.Note }
|
||||||
|
|
||||||
await statePromise.then((versions) => {
|
await statePromise.then((versions) => {
|
||||||
for (const edit of versions) {
|
for (const edit of versions) {
|
||||||
const _time = new Date(edit.oldDate).getTime();
|
|
||||||
|
|
||||||
menu.push({
|
menu.push({
|
||||||
icon: 'ph-pencil-simple ph-bold ph-lg',
|
icon: 'ph-pencil-simple ph-bold ph-lg',
|
||||||
text: _time ? dateTimeFormat.format(_time) : dateTimeFormat.format(new Date(edit.updatedAt)),
|
text: dateTimeFormat.format(new Date(edit.oldDate)),
|
||||||
action: () => openVersion(edit),
|
action: () => openVersion(edit),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue