Skip to content

Commit 8b836f3

Browse files
Merge branch 'master' into MM-64951
2 parents c148af3 + 57f4abe commit 8b836f3

10 files changed

Lines changed: 63 additions & 17 deletions

File tree

.github/workflows/build-for-pr.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
cache-dependency-path: package-lock.json
6565
- name: ci/cache-node-modules
6666
id: cache-node-modules
67-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
67+
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
6868
with:
6969
path: node_modules
7070
key: ${{ runner.os }}-build-node-modules-${{ hashFiles('**/package-lock.json') }}
@@ -96,7 +96,7 @@ jobs:
9696
cache-dependency-path: package-lock.json
9797
- name: ci/cache-node-modules
9898
id: cache-node-modules
99-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
99+
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
100100
with:
101101
path: node_modules
102102
key: ${{ runner.os }}-build-node-modules-${{ hashFiles('package-lock.json') }}

.github/workflows/ci.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
cache-dependency-path: package-lock.json
6464
- name: ci/cache-node-modules
6565
id: cache-node-modules
66-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
66+
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
6767
with:
6868
path: node_modules
6969
key: ${{ runner.os }}-build-node-modules-${{ hashFiles('**/package-lock.json') }}
@@ -96,7 +96,7 @@ jobs:
9696
cache-dependency-path: package-lock.json
9797
- name: ci/cache-node-modules
9898
id: cache-node-modules
99-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
99+
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
100100
with:
101101
path: node_modules
102102
key: ${{ runner.os }}-build-node-modules-${{ hashFiles('package-lock.json') }}
@@ -200,17 +200,17 @@ jobs:
200200
pull-requests: write
201201
steps:
202202
- name: ci/download-macos-test-results
203-
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
203+
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
204204
with:
205205
name: macos-test-results
206206
path: macos-test-results
207207
- name: ci/download-windows-test-results
208-
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
208+
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
209209
with:
210210
name: windows-test-results
211211
path: windows-test-results
212212
- name: ci/download-linux-test-results
213-
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
213+
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
214214
with:
215215
name: linux-test-results
216216
path: linux-test-results

.github/workflows/e2e-functional-template.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ jobs:
219219

220220
- name: e2e/cache-node-modules
221221
id: cache-node-modules
222-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
222+
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
223223
with:
224224
path: |
225225
node_modules

.github/workflows/nightly-main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,13 +208,13 @@ jobs:
208208
with:
209209
ref: ${{ env.REFERENCE }}
210210
- name: nightly/setup-aws-credentials
211-
uses: aws-actions/configure-aws-credentials@b47578312673ae6fa5b5096b330d9fbac3d116df # v4.2.1
211+
uses: aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a # v4.3.1
212212
with:
213213
aws-region: us-east-1
214214
aws-access-key-id: ${{ secrets.MM_DESKTOP_RELEASE_AWS_ACCESS_KEY_ID }}
215215
aws-secret-access-key: ${{ secrets.MM_DESKTOP_RELEASE_AWS_SECRET_ACCESS_KEY }}
216216
- name: nightly/download-builds
217-
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
217+
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
218218
with:
219219
path: build
220220
pattern: build-nightly-main-*

.github/workflows/nightly-rainforest.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,13 @@ jobs:
132132
with:
133133
ref: ${{ env.REFERENCE }}
134134
- name: nightly/setup-aws-credentials
135-
uses: aws-actions/configure-aws-credentials@b47578312673ae6fa5b5096b330d9fbac3d116df # v4.2.1
135+
uses: aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a # v4.3.1
136136
with:
137137
aws-region: us-east-1
138138
aws-access-key-id: ${{ secrets.MM_DESKTOP_DAILY_AWS_ACCESS_KEY_ID }}
139139
aws-secret-access-key: ${{ secrets.MM_DESKTOP_DAILY_AWS_SECRET_ACCESS_KEY }}
140140
- name: nightly/download-builds
141-
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
141+
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
142142
with:
143143
path: build
144144
pattern: build-rainforest-*

.github/workflows/release.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,14 +177,14 @@ jobs:
177177
- build-linux
178178
steps:
179179
- name: release/setup-aws-credentials
180-
uses: aws-actions/configure-aws-credentials@b47578312673ae6fa5b5096b330d9fbac3d116df # v4.2.1
180+
uses: aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a # v4.3.1
181181
with:
182182
aws-region: us-east-1
183183
aws-access-key-id: ${{ secrets.MM_DESKTOP_RELEASE_AWS_ACCESS_KEY_ID }}
184184
aws-secret-access-key: ${{ secrets.MM_DESKTOP_RELEASE_AWS_SECRET_ACCESS_KEY }}
185185

186186
- name: release/download-builds
187-
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
187+
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
188188
with:
189189
path: build
190190
pattern: build-*
@@ -206,7 +206,7 @@ jobs:
206206
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
207207

208208
- name: release/download-builds
209-
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
209+
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
210210
with:
211211
path: build
212212
pattern: build-*

i18n/en.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
{
2+
"callsWidgetWindow.cannotStartCall.message": "There is an in-progress call on another server that must be ended before joining a new call.",
3+
"callsWidgetWindow.cannotStartCall.title": "Cannot Start Call",
24
"common.permissions.canBasicAuth": "Web Authentication",
35
"common.tabs.TAB_FOCALBOARD": "Boards",
46
"common.tabs.TAB_MESSAGING": "Channels",

i18n/en_AU.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,11 @@
292292
"renderer.components.settingsPage.servers": "Servers",
293293
"renderer.components.settingsPage.showUnreadBadge": "Show red badge on {taskbar} icon to indicate unread messages",
294294
"renderer.components.settingsPage.showUnreadBadge.description": "Regardless of this setting, mentions are always indicated with a red badge and item count on the {taskbar} icon.",
295+
"renderer.components.settingsPage.showUnreadBadge.description.dock": "Regardless of this setting, mentions are always indicated with a red badge and item count on the Dock icon.",
296+
"renderer.components.settingsPage.showUnreadBadge.description.taskbar": "Regardless of this setting, mentions are always indicated with a red badge and item count on the taskbar icon.",
297+
"renderer.components.settingsPage.showUnreadBadge.dock": "Show red badge on Dock icon to indicate unread messages",
295298
"renderer.components.settingsPage.showUnreadBadge.heading": "Unread Badge",
299+
"renderer.components.settingsPage.showUnreadBadge.taskbar": "Show red badge on taskbar icon to indicate unread messages",
296300
"renderer.components.settingsPage.spellChecker": "Spell Checker",
297301
"renderer.components.settingsPage.spellCheckerSetting.language": "Spell Checker Languages",
298302
"renderer.components.settingsPage.startAppOnLogin": "Start app on login",

src/main/windows/callsWidgetWindow.test.js

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ jest.mock('electron', () => ({
4646
getUserDefault: jest.fn(),
4747
getMediaAccessStatus: jest.fn(() => 'granted'),
4848
},
49+
dialog: {
50+
showErrorBox: jest.fn(),
51+
},
4952
}));
5053

5154
jest.mock('../views/webContentEvents', () => ({
@@ -589,10 +592,31 @@ describe('main/windows/callsWidgetWindow', () => {
589592

590593
const window = {webContents: {id: 3}};
591594
callsWidgetWindow.win = window;
595+
callsWidgetWindow.mainView = {view: {server: {id: 'server-1'}}, webContentsId: 1};
592596
callsWidgetWindow.options = {callID: 'test'};
593-
await callsWidgetWindow.handleCreateCallsWidgetWindow({sender: {id: 2}}, {callID: 'test2'});
597+
await callsWidgetWindow.handleCreateCallsWidgetWindow({sender: {id: 1}}, {callID: 'test2'});
594598
expect(callsWidgetWindow.win).not.toEqual(window);
595599
});
600+
601+
it('should not create a new window if switching calls between servers and an in-progress call exists', async () => {
602+
let func;
603+
ipcMain.on.mockImplementation((_, callback) => {
604+
func = callback;
605+
});
606+
browserWindow.loadURL.mockImplementation(() => {
607+
func({sender: {id: 1}}, 'test2');
608+
return Promise.resolve();
609+
});
610+
BrowserWindow.mockReturnValue(browserWindow);
611+
ViewManager.getViewByWebContentsId.mockReturnValue({sendToRenderer: jest.fn()});
612+
613+
const window = {webContents: {id: 3}};
614+
callsWidgetWindow.win = window;
615+
callsWidgetWindow.mainView = {view: {server: {id: 'server-2'}}, webContentsId: 1};
616+
callsWidgetWindow.options = {callID: 'test'};
617+
await callsWidgetWindow.handleCreateCallsWidgetWindow({sender: {id: 2}}, {callID: 'test2'});
618+
expect(callsWidgetWindow.win).toEqual(window);
619+
});
596620
});
597621

598622
describe('handleGetDesktopSources', () => {

src/main/windows/callsWidgetWindow.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// See LICENSE.txt for license information.
33

44
import type {IpcMainEvent, Rectangle, Event, IpcMainInvokeEvent} from 'electron';
5-
import {BrowserWindow, desktopCapturer, ipcMain, systemPreferences} from 'electron';
5+
import {BrowserWindow, desktopCapturer, dialog, ipcMain, systemPreferences} from 'electron';
66

77
import ServerViewState from 'app/serverViewState';
88
import {
@@ -27,6 +27,7 @@ import {Logger} from 'common/log';
2727
import {CALLS_PLUGIN_ID, MINIMUM_CALLS_WIDGET_HEIGHT, MINIMUM_CALLS_WIDGET_WIDTH} from 'common/utils/constants';
2828
import {getFormattedPathName, isCallsPopOutURL, parseURL} from 'common/utils/url';
2929
import Utils from 'common/utils/util';
30+
import {localizeMessage} from 'main/i18nManager';
3031
import performanceMonitor from 'main/performanceMonitor';
3132
import PermissionsManager from 'main/permissionsManager';
3233
import {
@@ -54,6 +55,7 @@ export class CallsWidgetWindow {
5455
private mainView?: MattermostWebContentsView;
5556
private options?: CallsWidgetWindowConfig;
5657
private missingScreensharePermissions?: boolean;
58+
private seenErrorMessage?: boolean;
5759

5860
private popOut?: BrowserWindow;
5961
private boundsErr: Rectangle = {
@@ -483,6 +485,20 @@ export class CallsWidgetWindow {
483485
private handleCreateCallsWidgetWindow = async (event: IpcMainInvokeEvent, msg: CallsJoinCallMessage) => {
484486
log.debug('createCallsWidgetWindow');
485487

488+
if (this.mainView && event.sender.id !== this.mainView.webContentsId) {
489+
ViewManager.getViewByWebContentsId(event.sender.id)?.sendToRenderer(CALLS_ERROR);
490+
491+
// We only want to show the error message once to avoid spamming the user with dialog boxes
492+
if (!this.seenErrorMessage) {
493+
dialog.showErrorBox(
494+
localizeMessage('callsWidgetWindow.cannotStartCall.title', 'Cannot Start Call'),
495+
localizeMessage('callsWidgetWindow.cannotStartCall.message', 'There is an in-progress call on another server that must be ended before joining a new call.'),
496+
);
497+
this.seenErrorMessage = true;
498+
}
499+
return Promise.resolve();
500+
}
501+
486502
// trying to join again the call we are already in should not be allowed.
487503
if (this.options?.callID === msg.callID) {
488504
return Promise.resolve();

0 commit comments

Comments
 (0)