Co-authored-by: MeiMei <30769358+mei23@users.noreply.github.com>
Co-authored-by: Satsuki Yanagi <17376330+u1-liquid@users.noreply.github.com>
This commit is contained in:
syuilo
2020-01-30 04:37:25 +09:00
committed by GitHub
parent a5955c1123
commit f6154dc0af
871 changed files with 26140 additions and 71950 deletions

View File

@@ -7,6 +7,7 @@ import { Emojis, Users, Apps, PollVotes, DriveFiles, NoteReactions, Followings,
import { ensure } from '../../prelude/ensure';
import { SchemaType } from '../../misc/schema';
import { awaitAll } from '../../prelude/await-all';
import { convertLegacyReaction } from '../../misc/reaction-lib';
export type PackedNote = SchemaType<typeof packedNoteSchema>;
@@ -71,7 +72,6 @@ export class NoteRepository extends Repository<Note> {
packedNote.text = null;
packedNote.poll = undefined;
packedNote.cw = null;
packedNote.geo = undefined;
packedNote.isHidden = true;
}
}
@@ -163,7 +163,7 @@ export class NoteRepository extends Repository<Note> {
});
if (reaction) {
return reaction.reaction;
return convertLegacyReaction(reaction.reaction);
}
return undefined;
@@ -178,7 +178,6 @@ export class NoteRepository extends Repository<Note> {
const packed = await awaitAll({
id: note.id,
createdAt: note.createdAt.toISOString(),
app: note.appId ? Apps.pack(note.appId) : undefined,
userId: note.userId,
user: Users.pack(note.user || note.userId, meId),
text: text,
@@ -189,7 +188,7 @@ export class NoteRepository extends Repository<Note> {
viaMobile: note.viaMobile || undefined,
renoteCount: note.renoteCount,
repliesCount: note.repliesCount,
reactions: note.reactions,
reactions: note.reactions, // v12 TODO: convert legacy reaction
tags: note.tags.length > 0 ? note.tags : undefined,
emojis: populateEmojis(note.emojis, host, Object.keys(note.reactions)),
fileIds: note.fileIds,
@@ -356,9 +355,6 @@ export const packedNoteSchema = {
type: 'object' as const,
optional: true as const, nullable: true as const,
},
geo: {
type: 'object' as const,
optional: true as const, nullable: true as const,
},
},
};