From eda2907fec0a0b7cf72da4e7c43d10580c0b25bc Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 22 Sep 2026 16:43:59 +0000 Subject: [PATCH] Hang up incoming calls with the maintenance message when set event-management-nra and teacher-report-nra already check this.user.additionalData?.maintainanceMessage at the top of processCall() and hang up immediately with it; this project's own processCall never did (its class docstring already claimed it does, which was stale until now). Wires the same check here, using this.user?.additionalData to match this file's existing null-tolerant pattern for this.user (see hasPermission(this.user, ...) above). Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01VwgtFx4bsoC4bS1Mw2jBms --- server/src/yemot-handler.service.test.ts | 12 ++++++++++++ server/src/yemot-handler.service.ts | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/server/src/yemot-handler.service.test.ts b/server/src/yemot-handler.service.test.ts index 822f034a..deb24d3c 100644 --- a/server/src/yemot-handler.service.test.ts +++ b/server/src/yemot-handler.service.test.ts @@ -132,6 +132,18 @@ describe('YemotHandlerService — react-admin-nestjs', () => { beforeEach(() => useFakeDateOnly()); afterEach(() => jest.useRealTimers()); + it('maintenance message — immediate hangup, no call routing', async () => { + const scenario = baseSetup('Maintenance message', { + user: { ...baseUser, additionalData: { maintainanceMessage: 'System under maintenance' } }, + }) + .systemHangsUp('System under maintenance') + .build(); + + const result = await runner.run(scenario); + expect(result.passed).toBe(true); + expect(result.hungup).toBe(true); + }); + it('past deadline — immediate hangup with CLOSED', async () => { jest.setSystemTime(israelTimeAt(9, 0)); diff --git a/server/src/yemot-handler.service.ts b/server/src/yemot-handler.service.ts index 5810ae4d..e29ddb7c 100644 --- a/server/src/yemot-handler.service.ts +++ b/server/src/yemot-handler.service.ts @@ -25,6 +25,11 @@ export class YemotHandlerService extends BaseYemotHandlerService { override async processCall(): Promise { await this.getUserByDidPhone(); this.logger.log(`Processing call with ID: ${this.call.callId} from phone: ${this.call.phone}`); + + if (this.user?.additionalData?.maintainanceMessage) { + return this.hangupWithMessage(this.user.additionalData.maintainanceMessage); + } + if (hasPermission(this.user, 'seminarAttendanceYemot')) { if (this.isManagerCall()) { await this.processManagerReportCall();