diff options
| author | おさむのひと <46447427+samunohito@users.noreply.github.com> | 2023-11-21 15:32:34 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-21 15:32:34 +0900 |
| commit | b3d1cc9525b44e37b983c3a97af4e2aea80ea735 (patch) | |
| tree | 753a981fd65a8794c92c703ad642598fae176044 /packages/backend/src/server/api/endpoints | |
| parent | note.tsのchannelを正しい形にしたことにより表出化した型チ... (diff) | |
| download | sharkey-b3d1cc9525b44e37b983c3a97af4e2aea80ea735.tar.gz sharkey-b3d1cc9525b44e37b983c3a97af4e2aea80ea735.tar.bz2 sharkey-b3d1cc9525b44e37b983c3a97af4e2aea80ea735.zip | |
サーバ起動時にアンテナが非アクティブだった場合、アクティブ化しても再起動するまで反映されない (#12391)
* サーバ起動時にアンテナが非アクティブだった場合、アクティブ化しても再起動するまで反映されない
* Fix CHANGELOG.md
* lastUsedAtの更新に不備が出るので修正
---------
Co-authored-by: osamu <46447427+sam-osamu@users.noreply.github.com>
Diffstat (limited to 'packages/backend/src/server/api/endpoints')
| -rw-r--r-- | packages/backend/src/server/api/endpoints/antennas/notes.ts | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/packages/backend/src/server/api/endpoints/antennas/notes.ts b/packages/backend/src/server/api/endpoints/antennas/notes.ts index 9b5911800c..29e56b1085 100644 --- a/packages/backend/src/server/api/endpoints/antennas/notes.ts +++ b/packages/backend/src/server/api/endpoints/antennas/notes.ts @@ -13,6 +13,7 @@ import { DI } from '@/di-symbols.js'; import { NoteEntityService } from '@/core/entities/NoteEntityService.js'; import { IdService } from '@/core/IdService.js'; import { FunoutTimelineService } from '@/core/FunoutTimelineService.js'; +import { GlobalEventService } from '@/core/GlobalEventService.js'; import { ApiError } from '../../error.js'; export const meta = { @@ -71,6 +72,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint- private queryService: QueryService, private noteReadService: NoteReadService, private funoutTimelineService: FunoutTimelineService, + private globalEventService: GlobalEventService, ) { super(meta, paramDef, async (ps, me) => { const untilId = ps.untilId ?? (ps.untilDate ? this.idService.gen(ps.untilDate!) : null); @@ -85,10 +87,16 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint- throw new ApiError(meta.errors.noSuchAntenna); } - this.antennasRepository.update(antenna.id, { - isActive: true, - lastUsedAt: new Date(), - }); + // falseだった場合はアンテナの配信先が増えたことを通知したい + const needPublishEvent = !antenna.isActive; + + antenna.isActive = true; + antenna.lastUsedAt = new Date(); + this.antennasRepository.update(antenna.id, antenna); + + if (needPublishEvent) { + this.globalEventService.publishInternalEvent('antennaUpdated', antenna); + } let noteIds = await this.funoutTimelineService.get(`antennaTimeline:${antenna.id}`, untilId, sinceId); noteIds = noteIds.slice(0, ps.limit); |