diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2023-10-06 14:24:25 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2023-10-06 14:24:25 +0900 |
| commit | dab205edb87ea9cdaee5b6564aa11dfcea245d7b (patch) | |
| tree | e29a7874da5395a67a516c2164a82c050071dd2d /packages/backend/src/core/NoteCreateService.ts | |
| parent | chore(backend): response isHibernated in admin/show-user (diff) | |
| download | sharkey-dab205edb87ea9cdaee5b6564aa11dfcea245d7b.tar.gz sharkey-dab205edb87ea9cdaee5b6564aa11dfcea245d7b.tar.bz2 sharkey-dab205edb87ea9cdaee5b6564aa11dfcea245d7b.zip | |
enhance(backend): improve featured system
Diffstat (limited to 'packages/backend/src/core/NoteCreateService.ts')
| -rw-r--r-- | packages/backend/src/core/NoteCreateService.ts | 12 |
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 |