[MM-37379] Add "Clear Data" options in the menu to allow users to force Electron to blow away session data. (#3185)

* [MM-37379] Add "Clear Data" options in the menu to allow users to force Electron to blow away session data.

* Fix i18n

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
This commit is contained in:
Devin Binnie
2024-11-26 10:03:25 -05:00
committed by GitHub
parent 057572e847
commit 723fda8abb
4 changed files with 73 additions and 0 deletions

View File

@@ -74,6 +74,7 @@ jest.mock('app/serverViewState', () => ({
switchServer: jest.fn(),
getCurrentServer: jest.fn(),
}));
jest.mock('main/app/utils', () => ({}));
jest.mock('main/diagnostics', () => ({}));
jest.mock('main/downloadsManager', () => ({
hasDownloads: jest.fn(),

View File

@@ -15,6 +15,7 @@ import ServerManager from 'common/servers/serverManager';
import {t} from 'common/utils/util';
import {getViewDisplayName} from 'common/views/View';
import type {ViewType} from 'common/views/View';
import {clearAllData, clearDataForServer} from 'main/app/utils';
import type {UpdateManager} from 'main/autoUpdater';
import DeveloperMode from 'main/developerMode';
import Diagnostics from 'main/diagnostics';
@@ -274,6 +275,18 @@ export function createTemplate(config: Config, updateManager: UpdateManager) {
click() {
return downloadsManager.openDownloadsDropdown();
},
}, separatorItem, {
id: 'clear-data-for-server',
label: localizeMessage('main.menus.app.view.clearDataForServer', 'Clear Data for Current Server'),
async click() {
return clearDataForServer(ServerViewState.getCurrentServer());
},
}, {
id: 'clear-data',
label: localizeMessage('main.menus.app.view.clearAllData', 'Clear All Data'),
async click() {
return clearAllData();
},
}, separatorItem, {
label: localizeMessage('main.menus.app.view.devToolsSubMenu', 'Developer Tools'),
submenu: devToolsSubMenu,