mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-29 13:27:31 -07:00
Clean packed responses
This commit is contained in:
parent
7108b30078
commit
83b4d01135
2 changed files with 11 additions and 11 deletions
|
@ -162,15 +162,15 @@ export class NoteRepository extends Repository<Note> {
|
||||||
const packed = await rap({
|
const packed = await rap({
|
||||||
id: note.id,
|
id: note.id,
|
||||||
createdAt: note.createdAt,
|
createdAt: note.createdAt,
|
||||||
app: note.appId ? Apps.pack(note.appId) : null,
|
app: note.appId ? Apps.pack(note.appId) : undefined,
|
||||||
userId: note.userId,
|
userId: note.userId,
|
||||||
user: Users.pack(note.user || note.userId, meId),
|
user: Users.pack(note.user || note.userId, meId),
|
||||||
text: text,
|
text: text,
|
||||||
cw: note.cw,
|
cw: note.cw,
|
||||||
visibility: note.visibility,
|
visibility: note.visibility,
|
||||||
localOnly: note.localOnly,
|
localOnly: note.localOnly || undefined,
|
||||||
visibleUserIds: note.visibleUserIds,
|
visibleUserIds: note.visibility === 'specified' ? note.visibleUserIds : undefined,
|
||||||
viaMobile: note.viaMobile,
|
viaMobile: note.viaMobile || undefined,
|
||||||
renoteCount: note.renoteCount,
|
renoteCount: note.renoteCount,
|
||||||
repliesCount: note.repliesCount,
|
repliesCount: note.repliesCount,
|
||||||
reactions: note.reactions,
|
reactions: note.reactions,
|
||||||
|
@ -188,13 +188,13 @@ export class NoteRepository extends Repository<Note> {
|
||||||
...(opts.detail ? {
|
...(opts.detail ? {
|
||||||
reply: note.replyId ? this.pack(note.replyId, meId, {
|
reply: note.replyId ? this.pack(note.replyId, meId, {
|
||||||
detail: false
|
detail: false
|
||||||
}) : null,
|
}) : undefined,
|
||||||
|
|
||||||
renote: note.renoteId ? this.pack(note.renoteId, meId, {
|
renote: note.renoteId ? this.pack(note.renoteId, meId, {
|
||||||
detail: true
|
detail: true
|
||||||
}) : null,
|
}) : undefined,
|
||||||
|
|
||||||
poll: note.hasPoll ? populatePoll() : null,
|
poll: note.hasPoll ? populatePoll() : undefined,
|
||||||
|
|
||||||
...(meId ? {
|
...(meId ? {
|
||||||
myReaction: populateMyReaction()
|
myReaction: populateMyReaction()
|
||||||
|
|
|
@ -92,10 +92,10 @@ export class UserRepository extends Repository<User> {
|
||||||
bannerUrl: user.bannerUrl,
|
bannerUrl: user.bannerUrl,
|
||||||
avatarColor: user.avatarColor,
|
avatarColor: user.avatarColor,
|
||||||
bannerColor: user.bannerColor,
|
bannerColor: user.bannerColor,
|
||||||
isAdmin: user.isAdmin,
|
isAdmin: user.isAdmin || undefined,
|
||||||
isBot: user.isBot,
|
isBot: user.isBot || undefined,
|
||||||
isCat: user.isCat,
|
isCat: user.isCat || undefined,
|
||||||
isVerified: user.isVerified,
|
isVerified: user.isVerified || undefined,
|
||||||
|
|
||||||
// カスタム絵文字添付
|
// カスタム絵文字添付
|
||||||
emojis: user.emojis.length > 0 ? Emojis.find({
|
emojis: user.emojis.length > 0 ? Emojis.find({
|
||||||
|
|
Loading…
Reference in a new issue