This commit is contained in:
syuilo 2018-06-16 10:40:53 +09:00
parent f164661ef2
commit e11f547308
8 changed files with 102 additions and 22 deletions

View file

@ -18,6 +18,7 @@ import parse from '../../text/parse';
import { IApp } from '../../models/app';
import UserList from '../../models/user-list';
import resolveUser from '../../remote/resolve-user';
import Meta from '../../models/meta';
type Reason = 'reply' | 'quote' | 'mention';
@ -167,7 +168,24 @@ export default async (user: IUser, data: {
res(note);
// Increment notes count
//#region Increment notes count
if (isLocalUser(user)) {
Meta.update({}, {
$inc: {
'stats.notesCount': 1,
'stats.originalNotesCount': 1
}
}, { upsert: true });
} else {
Meta.update({}, {
$inc: {
'stats.notesCount': 1
}
}, { upsert: true });
}
//#endregion
// Increment notes count (user)
User.update({ _id: user._id }, {
$inc: {
notesCount: 1