Downloads fixes (#2331) (#2332)

* Add file extension when necessary

* [MM-48017] Set the bounds for the dropdowns on finished resize

(cherry picked from commit 6ae055728d)

Co-authored-by: Devin Binnie <52460000+devinbinnie@users.noreply.github.com>
This commit is contained in:
Mattermost Build 2022-10-28 23:20:45 +03:00 committed by GitHub
parent 5fc023c6ef
commit fb3d54c9bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 8 deletions

View file

@ -401,7 +401,7 @@ export class DownloadsManager extends JsonFileManager<DownloadedItems> {
private showSaveDialog = (item: DownloadItem) => { private showSaveDialog = (item: DownloadItem) => {
const filename = item.getFilename(); const filename = item.getFilename();
const fileElements = filename.split('.'); const fileElements = filename.split('.');
const filters = this.getFileFilters(fileElements); const filters = this.getFileFilters(fileElements.slice(1));
return dialog.showSaveDialog({ return dialog.showSaveDialog({
title: filename, title: filename,
@ -590,14 +590,15 @@ export class DownloadsManager extends JsonFileManager<DownloadedItems> {
}; };
private getFileFilters = (fileElements: string[]): FileFilter[] => { private getFileFilters = (fileElements: string[]): FileFilter[] => {
const filters = []; const filters = fileElements.map((element) => ({
name: `${element.toUpperCase()} (*.${element})`,
extensions: [element],
}));
if (fileElements.length > 1) { filters.push({
filters.push({ name: localizeMessage('main.app.initialize.downloadBox.allFiles', 'All files'),
name: localizeMessage('main.app.initialize.downloadBox.allFiles', 'All files'), extensions: ['*'],
extensions: ['*'], });
});
}
return filters; return filters;
}; };

View file

@ -223,6 +223,9 @@ export class WindowManager {
const bounds = this.getBounds(); const bounds = this.getBounds();
this.throttledWillResize(bounds); this.throttledWillResize(bounds);
ipcMain.emit(RESIZE_MODAL, null, bounds); ipcMain.emit(RESIZE_MODAL, null, bounds);
this.teamDropdown?.updateWindowBounds();
this.downloadsDropdown?.updateWindowBounds();
this.downloadsDropdownMenu?.updateWindowBounds();
} }
this.isResizing = false; this.isResizing = false;
} }
@ -254,6 +257,7 @@ export class WindowManager {
this.viewManager.setLoadingScreenBounds(); this.viewManager.setLoadingScreenBounds();
this.teamDropdown?.updateWindowBounds(); this.teamDropdown?.updateWindowBounds();
this.downloadsDropdown?.updateWindowBounds(); this.downloadsDropdown?.updateWindowBounds();
this.downloadsDropdownMenu?.updateWindowBounds();
ipcMain.emit(RESIZE_MODAL, null, bounds); ipcMain.emit(RESIZE_MODAL, null, bounds);
}; };