[MM-52139] Force user to reset default downloads directory when the app is not allowed to access it (#2699)

* [MM-52139] Force user to reset default downloads directory when the app is not allowed to access it

* Fix a bug where a different download location choice would cause a problem

* Missed i18n
This commit is contained in:
Devin Binnie
2023-05-02 14:37:14 -04:00
committed by GitHub
parent 09fe196bc6
commit f3a4417464
4 changed files with 50 additions and 19 deletions

View File

@@ -1,18 +1,17 @@
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {app, dialog, IpcMainEvent, IpcMainInvokeEvent, Menu} from 'electron';
import {app, IpcMainEvent, IpcMainInvokeEvent, Menu} from 'electron';
import {MattermostTeam} from 'types/config';
import {MentionData} from 'types/notification';
import Config from 'common/config';
import {Logger} from 'common/log';
import ServerManager from 'common/servers/serverManager';
import {ping} from 'common/utils/requests';
import {displayMention} from 'main/notifications';
import {getLocalPreload, getLocalURLString} from 'main/utils';
import ServerManager from 'common/servers/serverManager';
import ModalManager from 'main/views/modalManager';
import MainWindow from 'main/windows/mainWindow';
@@ -130,17 +129,6 @@ export function handleOpenAppMenu() {
});
}
export async function handleSelectDownload(event: IpcMainInvokeEvent, startFrom: string) {
log.debug('handleSelectDownload', startFrom);
const message = 'Specify the folder where files will download';
const result = await dialog.showOpenDialog({defaultPath: startFrom || Config.downloadLocation,
message,
properties:
['openDirectory', 'createDirectory', 'dontAddToRecent', 'promptToCreate']});
return result.filePaths[0];
}
export function handlePingDomain(event: IpcMainInvokeEvent, url: string): Promise<string> {
return Promise.allSettled([
ping(new URL(`https://${url}`)),