summaryrefslogtreecommitdiff
path: root/packages/backend/src/core/NoteCreateService.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/backend/src/core/NoteCreateService.ts')
-rw-r--r--packages/backend/src/core/NoteCreateService.ts12
1 files changed, 11 insertions, 1 deletions
diff --git a/packages/backend/src/core/NoteCreateService.ts b/packages/backend/src/core/NoteCreateService.ts
index 34d103df77..ca9dbfa642 100644
--- a/packages/backend/src/core/NoteCreateService.ts
+++ b/packages/backend/src/core/NoteCreateService.ts
@@ -53,6 +53,7 @@ import { DB_MAX_NOTE_TEXT_LENGTH } from '@/const.js';
import { RoleService } from '@/core/RoleService.js';
import { MetaService } from '@/core/MetaService.js';
import { SearchService } from '@/core/SearchService.js';
+import { FeaturedService } from '@/core/FeaturedService.js';
type NotificationType = 'reply' | 'renote' | 'quote' | 'mention';
@@ -200,6 +201,7 @@ export class NoteCreateService implements OnApplicationShutdown {
private hashtagService: HashtagService,
private antennaService: AntennaService,
private webhookService: WebhookService,
+ private featuredService: FeaturedService,
private remoteUserResolveService: RemoteUserResolveService,
private apDeliverManagerService: ApDeliverManagerService,
private apRendererService: ApRendererService,
@@ -721,10 +723,18 @@ export class NoteCreateService implements OnApplicationShutdown {
this.notesRepository.createQueryBuilder().update()
.set({
renoteCount: () => '"renoteCount" + 1',
- score: () => '"score" + 1',
})
.where('id = :id', { id: renote.id })
.execute();
+
+ // 30%の確率でハイライト用ランキング更新
+ if (Math.random() < 0.3) {
+ if (renote.channelId != null) {
+ this.featuredService.updateInChannelNotesRanking(renote.id, renote.channelId, 1);
+ } else if (renote.visibility === 'public' && renote.userHost == null) {
+ this.featuredService.updateGlobalNotesRanking(renote.id, 1);
+ }
+ }
}
@bindThis