Skip to content

Calls: "test mode" alert when joining a call right after opening the app from a notification #10038

Description

@andrew83742

Summary

Tapping a call notification and immediately joining the call shows the "Calls is not currently enabled / Calls are currently running in test mode and only system admins can start them" alert, even though DefaultEnabled is true on the server.

Opening the app normally from the launcher and joining the same call works fine.

Steps to reproduce

  1. Server has the Calls plugin with DefaultEnabled: true (calls enabled for everyone, not test mode)
  2. Sign in as a non-admin user on Android
  3. Have someone start a call in a DM/channel so a "You've been invited to a call" push notification arrives
  4. Tap the notification — the app opens
  5. Navigate to the chat and tap Join

Expected

The user joins the call.

Actual

The contactAdminAlert is shown:

Calls are currently running in test mode and only system admins can start them. Reach out directly to your system admin for assistance

Workaround

Do not tap the notification. Open the app from the launcher, wait a moment, then join the call.

Analysis

The alert is gated on DefaultEnabled from the cached calls config (app/products/calls/alerts.ts):

const enabled = getCallsState(serverUrl).enabled[channelId];
const {DefaultEnabled} = getCallsConfig(serverUrl);
const isAdmin = isSystemAdmin(user.roles);

if (enabled || (!enabled && DefaultEnabled) || (!enabled && !DefaultEnabled && isAdmin)) {
    // continue through and start the call
} else {
    contactAdminAlert(intl);
}

The initial value of that config is false (app/products/calls/types/calls.ts):

export const DefaultCallsConfig: CallsConfigState = {
    pluginEnabled: false,
    ...
    DefaultEnabled: false,
    ...
};

The real value is only fetched by loadConfigAndCalls, which appears to be called just from the websocket handler, and not awaited (app/actions/websocket/index.ts):

if (isSupportedServerCalls(config?.Version)) {
    loadConfigAndCalls(serverUrl, currentUserId, groupLabel);
}

So there is a window between app launch and the config arriving, during which any non-admin who reaches the Join button sees the alert. Launching from a notification deep-links straight into the channel, which makes hitting that window very likely, while a normal launch gives the websocket time to connect first.

This also explains why the alert stops appearing once the config is cached (RefreshConfigMillis is 20 minutes).

Suggested fix

Either disable the Join button until the calls config has been retrieved, or force a config load when entering a channel from a notification, rather than treating "config not loaded yet" as "calls are disabled".

Environment

  • Mattermost Server: 11.9.0
  • Calls plugin: 1.12.1
  • Mattermost Mobile: 2.42.2 (build 6000787)
  • Platform: Android

Checked the v2.42.3 changelog, it only contains fixes for empty channel rendering and the Enter key, nothing related to calls, config loading, notifications or websockets, so this does not appear to be fixed there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions