summaryrefslogtreecommitdiff
path: root/src/services
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-10-25 07:04:15 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-10-25 07:04:15 +0900
commit380f5a972c4bdf40c12273426f2dd1a9e16b81a2 (patch)
treea8670f76343449ec3dc5c50176a152a435a7d512 /src/services
parentUpdate Node.js to v11 (diff)
downloadmisskey-380f5a972c4bdf40c12273426f2dd1a9e16b81a2.tar.gz
misskey-380f5a972c4bdf40c12273426f2dd1a9e16b81a2.tar.bz2
misskey-380f5a972c4bdf40c12273426f2dd1a9e16b81a2.zip
Implement featured note API
Diffstat (limited to 'src/services')
-rw-r--r--src/services/note/create.ts3
-rw-r--r--src/services/note/reaction/create.ts8
2 files changed, 6 insertions, 5 deletions
diff --git a/src/services/note/create.ts b/src/services/note/create.ts
index 96ffe96873..55e1d569a3 100644
--- a/src/services/note/create.ts
+++ b/src/services/note/create.ts
@@ -314,7 +314,8 @@ async function renderActivity(data: Option, note: INote) {
function incRenoteCount(renote: INote) {
Note.update({ _id: renote._id }, {
$inc: {
- renoteCount: 1
+ renoteCount: 1,
+ score: 1
}
});
}
diff --git a/src/services/note/reaction/create.ts b/src/services/note/reaction/create.ts
index edf6481092..4a09cf535f 100644
--- a/src/services/note/reaction/create.ts
+++ b/src/services/note/reaction/create.ts
@@ -36,12 +36,12 @@ export default async (user: IUser, note: INote, reaction: string) => new Promise
res();
- const inc: {[key: string]: number} = {};
- inc[`reactionCounts.${reaction}`] = 1;
-
// Increment reactions count
await Note.update({ _id: note._id }, {
- $inc: inc
+ $inc: {
+ [`reactionCounts.${reaction}`]: 1,
+ score: 1
+ }
});
perUserReactionsChart.update(user, note);