Skip to content

Commit f44242e

Browse files
committed
chore: remove checkPreMediaCallCreated from the handler interface
1 parent 233cd89 commit f44242e

6 files changed

Lines changed: 0 additions & 79 deletions

File tree

apps/meteor/tests/data/apps/app-packages/README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -705,9 +705,6 @@ An app implementing every method of `IMediaCallHandler`. It records what each ha
705705
logs, which is how `tests/e2e/apps/media-call-events.spec.ts` asserts the events actually arrived, and it
706706
answers the pre-create event according to a mode the test sets beforehand.
707707

708-
`checkPreMediaCallCreated` is deliberately **not** implemented, so installing this app also covers the
709-
listener manager's `JSONRPC_METHOD_NOT_FOUND` fallback for that optional method.
710-
711708
**Mode endpoint:**
712709

713710
- `POST /api/apps/public/:appId/mode` with `{ "mode": "pass" | "prevent" | "drop-screen-share" }`

apps/meteor/tests/data/apps/app-packages/src/media-call-events-test/MediaCallEventsTestApp.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ import { readMode } from './lib/mode';
2020
/**
2121
* Exercises every method of `IMediaCallHandler` and records what it saw in the app
2222
* logs, which is how the e2e spec asserts the events actually arrived.
23-
*
24-
* `checkPreMediaCallCreated` is deliberately NOT implemented, so installing this app
25-
* also covers the listener manager's `JSONRPC_METHOD_NOT_FOUND` fallback for the
26-
* optional check method.
2723
*/
2824
export class MediaCallEventsTestApp extends App implements IMediaCallHandler {
2925
constructor(info: IAppInfo, logger: ILogger, accessors: IAppAccessors) {

packages/apps-engine/src/definition/mediaCalls/IMediaCallHandler.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,6 @@ import { AppMethod } from '../metadata';
1818
* that shapes the join event.
1919
*/
2020
export interface IMediaCallHandler {
21-
/**
22-
* Enables the handler to signal to the Apps framework whether this handler
23-
* should actually run for the media call about to be created.
24-
*/
25-
[AppMethod.CHECK_PRE_MEDIA_CALL_CREATED]?(context: IPreMediaCallCreatedContext, read: IRead, http: IHttp): Promise<boolean>;
26-
2721
/**
2822
* Called before a media call is created, and awaited: a slow handler delays
2923
* the call from ringing. May `pass`, `patch` the call's requested features, or

packages/apps-engine/src/definition/metadata/AppMethod.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ export enum AppMethod {
108108
EXECUTE_POST_USER_LOGGED_OUT = 'executePostUserLoggedOut',
109109
EXECUTE_POST_USER_STATUS_CHANGED = 'executePostUserStatusChanged',
110110
// Media calls
111-
CHECK_PRE_MEDIA_CALL_CREATED = 'checkPreMediaCallCreated',
112111
EXECUTE_PRE_MEDIA_CALL_CREATED = 'executePreMediaCallCreated',
113112
EXECUTE_POST_MEDIA_CALL_STARTED = 'executePostMediaCallStarted',
114113
EXECUTE_POST_MEDIA_CALL_PARTICIPANT_JOINED = 'executePostMediaCallParticipantJoined',

packages/apps/src/server/managers/AppListenerManager.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,19 +1314,6 @@ export class AppListenerManager {
13141314
for (const appId of this.listeners.get(AppInterface.IMediaCallHandler)) {
13151315
const app = this.manager.getOneById(appId);
13161316

1317-
const continueOn = (await app.call(AppMethod.CHECK_PRE_MEDIA_CALL_CREATED, context).catch((error) => {
1318-
// This method is optional, so if it doesn't exist, we should continue
1319-
if (error?.code === JSONRPC_METHOD_NOT_FOUND) {
1320-
return true;
1321-
}
1322-
1323-
throw error;
1324-
})) as boolean;
1325-
1326-
if (!continueOn) {
1327-
continue;
1328-
}
1329-
13301317
const result = await app.call(AppMethod.EXECUTE_PRE_MEDIA_CALL_CREATED, context).catch((error) => {
13311318
// Every method of IMediaCallHandler is optional: an app may implement the
13321319
// interface for the post events alone

packages/apps/tests/server/managers/AppListenerManager.mediaCalls.test.ts

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -175,37 +175,6 @@ describe('AppListenerManager media call events', () => {
175175
assert.deepStrictEqual(outcome, { prevented: false, context: { ...context, features: ['audio', 'hold'] } });
176176
});
177177

178-
it('does not run the handler of an app whose check opted out', async () => {
179-
let executed = false;
180-
const outcome = await runPreCallCreated([
181-
mockApp('opting-out', {
182-
[AppMethod.CHECK_PRE_MEDIA_CALL_CREATED]: () => false,
183-
[AppMethod.EXECUTE_PRE_MEDIA_CALL_CREATED]: () => {
184-
executed = true;
185-
return EventResult.prevent({ reason: 'should never run' });
186-
},
187-
}),
188-
]);
189-
190-
assert.strictEqual(executed, false);
191-
assert.deepStrictEqual(outcome, { prevented: false, context });
192-
});
193-
194-
it('runs the handler of an app whose check opted in', async () => {
195-
const outcome = await runPreCallCreated([
196-
mockApp('opting-in', {
197-
[AppMethod.CHECK_PRE_MEDIA_CALL_CREATED]: () => true,
198-
[AppMethod.EXECUTE_PRE_MEDIA_CALL_CREATED]: () => EventResult.prevent({ reason: 'callee is on a do-not-disturb list' }),
199-
}),
200-
]);
201-
202-
assert.deepStrictEqual(outcome, {
203-
prevented: true,
204-
appId: 'opting-in',
205-
reason: 'callee is on a do-not-disturb list',
206-
});
207-
});
208-
209178
it('drops a patch whose features are not a list', async () => {
210179
const { result: outcome, warnings } = await capturingWarnings(() =>
211180
runPreCallCreated([
@@ -260,27 +229,6 @@ describe('AppListenerManager media call events', () => {
260229
/app blew up/,
261230
);
262231
});
263-
264-
it('fails closed when an app check throws', async () => {
265-
let executed = false;
266-
267-
await assert.rejects(
268-
runPreCallCreated([
269-
mockApp('failing', {
270-
[AppMethod.CHECK_PRE_MEDIA_CALL_CREATED]: () => {
271-
throw new Error('check blew up');
272-
},
273-
[AppMethod.EXECUTE_PRE_MEDIA_CALL_CREATED]: () => {
274-
executed = true;
275-
return EventResult.pass();
276-
},
277-
}),
278-
]),
279-
/check blew up/,
280-
);
281-
282-
assert.strictEqual(executed, false);
283-
});
284232
});
285233

286234
describe('post media call events', () => {

0 commit comments

Comments
 (0)