mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-22 12:13:48 +01:00
[mastodon-client] Also return edit history if post is unedited
This commit is contained in:
parent
137ede02ce
commit
267624c7a3
@ -154,13 +154,11 @@ export class NoteHelpers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static async getNoteEditHistory(note: Note): Promise<MastodonEntity.StatusEdit[]> {
|
public static async getNoteEditHistory(note: Note): Promise<MastodonEntity.StatusEdit[]> {
|
||||||
if (!note.updatedAt) return [];
|
|
||||||
const cache = UserHelpers.getFreshAccountCache();
|
const cache = UserHelpers.getFreshAccountCache();
|
||||||
const account = Promise.resolve(note.user ?? await UserHelpers.getUserCached(note.userId, cache))
|
const account = Promise.resolve(note.user ?? await UserHelpers.getUserCached(note.userId, cache))
|
||||||
.then(p => UserConverter.encode(p, cache));
|
.then(p => UserConverter.encode(p, cache));
|
||||||
const edits = await NoteEdits.find({where: {noteId: note.id}, order: {id: "ASC"}});
|
const edits = await NoteEdits.find({where: {noteId: note.id}, order: {id: "ASC"}});
|
||||||
const history: Promise<MastodonEntity.StatusEdit>[] = [];
|
const history: Promise<MastodonEntity.StatusEdit>[] = [];
|
||||||
if (edits.length < 1) return [];
|
|
||||||
|
|
||||||
const curr = {
|
const curr = {
|
||||||
id: note.id,
|
id: note.id,
|
||||||
@ -169,7 +167,7 @@ export class NoteHelpers {
|
|||||||
text: note.text,
|
text: note.text,
|
||||||
cw: note.cw,
|
cw: note.cw,
|
||||||
fileIds: note.fileIds,
|
fileIds: note.fileIds,
|
||||||
updatedAt: note.updatedAt
|
updatedAt: note.updatedAt ?? note.createdAt
|
||||||
}
|
}
|
||||||
|
|
||||||
edits.push(curr);
|
edits.push(curr);
|
||||||
|
Loading…
Reference in New Issue
Block a user