Introduce per-instance chart (#4183)

* Introduce per-instance chart

* Implement chart view in client

* Handle note deleting

* More chart srcs

* Add drive stats

* Improve drive stats

* Fix bug

* Add icon
This commit is contained in:
syuilo 2019-02-08 16:58:57 +09:00 committed by GitHub
parent f35688bab8
commit 56275bcfcb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 746 additions and 13 deletions

View file

@ -1,5 +1,5 @@
import Note, { INote } from '../../models/note';
import { IUser, isLocalUser } from '../../models/user';
import { IUser, isLocalUser, isRemoteUser } from '../../models/user';
import { publishNoteStream } from '../stream';
import renderDelete from '../../remote/activitypub/renderer/delete';
import { renderActivity } from '../../remote/activitypub/renderer';
@ -12,6 +12,9 @@ import config from '../../config';
import NoteUnread from '../../models/note-unread';
import read from './read';
import DriveFile from '../../models/drive-file';
import { registerOrFetchInstanceDoc } from '../register-or-fetch-instance-doc';
import Instance from '../../models/instance';
import instanceChart from '../../services/chart/instance';
/**
* 稿
@ -91,4 +94,16 @@ export default async function(user: IUser, note: INote) {
// 統計を更新
notesChart.update(note, false);
perUserNotesChart.update(user, note, false);
if (isRemoteUser(user)) {
registerOrFetchInstanceDoc(user.host).then(i => {
Instance.update({ _id: i._id }, {
$inc: {
notesCount: -1
}
});
instanceChart.updateNote(i.host, false);
});
}
}