fix: Per user charts only followers available

This commit is contained in:
sim1222 2023-12-03 14:32:30 +09:00
parent 4714c207fc
commit 191ce11417
Signed by: sim1222
GPG Key ID: D1AE30E316E44E5D
3 changed files with 15 additions and 5 deletions

View File

@ -194,6 +194,7 @@ export class NoteCreateService {
host: User['host']; host: User['host'];
isSilenced: User['isSilenced']; isSilenced: User['isSilenced'];
createdAt: User['createdAt']; createdAt: User['createdAt'];
followersCount: User['followersCount'];
}, data: Option, silent = false): Promise<Note> { }, data: Option, silent = false): Promise<Note> {
// チャンネル外にリプライしたら対象のスコープに合わせる // チャンネル外にリプライしたら対象のスコープに合わせる
// (クライアントサイドでやっても良い処理だと思うけどとりあえずサーバーサイドで) // (クライアントサイドでやっても良い処理だと思うけどとりあえずサーバーサイドで)
@ -409,10 +410,14 @@ export class NoteCreateService {
host: User['host']; host: User['host'];
isSilenced: User['isSilenced']; isSilenced: User['isSilenced'];
createdAt: User['createdAt']; createdAt: User['createdAt'];
followersCount: User['followersCount'];
}, data: Option, silent: boolean, tags: string[], mentionedUsers: MinimumUser[]) { }, data: Option, silent: boolean, tags: string[], mentionedUsers: MinimumUser[]) {
// 統計を更新 // 統計を更新
this.notesChart.update(note, true); this.notesChart.update(note, true);
if (user.followersCount) {
this.perUserNotesChart.update(user, note, true); this.perUserNotesChart.update(user, note, true);
}
// Register host // Register host
if (this.userEntityService.isRemoteUser(user)) { if (this.userEntityService.isRemoteUser(user)) {

View File

@ -48,7 +48,7 @@ export class NoteDeleteService {
* @param user 稿 * @param user 稿
* @param note 稿 * @param note 稿
*/ */
async delete(user: { id: User['id']; uri: User['uri']; host: User['host']; }, note: Note, quiet = false) { async delete(user: { id: User['id']; uri: User['uri']; host: User['host']; followersCount: User['followersCount']; }, note: Note, quiet = false) {
const deletedAt = new Date(); const deletedAt = new Date();
// この投稿を除く指定したユーザーによる指定したノートのリノートが存在しないとき // この投稿を除く指定したユーザーによる指定したノートのリノートが存在しないとき
@ -96,7 +96,10 @@ export class NoteDeleteService {
// 統計を更新 // 統計を更新
this.notesChart.update(note, false); this.notesChart.update(note, false);
if (user.followersCount) {
this.perUserNotesChart.update(user, note, false); this.perUserNotesChart.update(user, note, false);
}
if (this.userEntityService.isRemoteUser(user)) { if (this.userEntityService.isRemoteUser(user)) {
this.federatedInstanceService.registerOrFetchInstanceDoc(user.host).then(i => { this.federatedInstanceService.registerOrFetchInstanceDoc(user.host).then(i => {

View File

@ -81,7 +81,7 @@ export class ReactionService {
) { ) {
} }
public async create(user: { id: User['id']; host: User['host']; }, note: Note, reaction?: string) { public async create(user: { id: User['id']; host: User['host']; followersCount: User['followersCount']; }, note: Note, reaction?: string) {
// Check blocking // Check blocking
if (note.userId !== user.id) { if (note.userId !== user.id) {
const block = await this.blockingsRepository.findOneBy({ const block = await this.blockingsRepository.findOneBy({
@ -142,7 +142,9 @@ export class ReactionService {
.where('id = :id', { id: note.id }) .where('id = :id', { id: note.id })
.execute(); .execute();
if (user.followersCount) {
this.perUserReactionsChart.update(user, note); this.perUserReactionsChart.update(user, note);
}
// カスタム絵文字リアクションだったら絵文字情報も送る // カスタム絵文字リアクションだったら絵文字情報も送る
const decodedReaction = this.decodeReaction(reaction); const decodedReaction = this.decodeReaction(reaction);