From 9a1f83e948c68e9dcf487ad25a9a12a252ee28c5 Mon Sep 17 00:00:00 2001
From: MeiMei <30769358+mei23@users.noreply.github.com>
Date: Sat, 29 Dec 2018 02:04:29 +0900
Subject: [PATCH] Resolve #3786 (#3788)
---
src/docs/api/entities/note.yaml | 14 ++++++++++++++
src/models/note.ts | 5 +++++
2 files changed, 19 insertions(+)
diff --git a/src/docs/api/entities/note.yaml b/src/docs/api/entities/note.yaml
index 89846a56c..ce0c5de2e 100644
--- a/src/docs/api/entities/note.yaml
+++ b/src/docs/api/entities/note.yaml
@@ -75,6 +75,20 @@ props:
ja-JP: "この投稿に対する自分のリアクション"
en-US: "The your reaction of this note"
+ renoteCount:
+ type: "number"
+ optional: false
+ desc:
+ ja-JP: "この投稿がRenoteされた数"
+ en-US: "The number of renotes for this post"
+
+ repliesCount:
+ type: "number"
+ optional: false
+ desc:
+ ja-JP: "この投稿に返信された数"
+ en-US: "The number of replies to this post"
+
reactionCounts:
type: "object"
optional: false
diff --git a/src/models/note.ts b/src/models/note.ts
index e76fc88a4..f14f4c133 100644
--- a/src/models/note.ts
+++ b/src/models/note.ts
@@ -273,6 +273,11 @@ export const pack = async (
// Populate files
_note.files = packFileMany(_note.fileIds || []);
+ // Some counts
+ _note.renoteCount = _note.renoteCount || 0;
+ _note.repliesCount = _note.repliesCount || 0;
+ _note.reactionCounts = _note.reactionCounts || {};
+
// 後方互換性のため
_note.mediaIds = _note.fileIds;
_note.media = _note.files;