From 6b9a2977f131ba1b2d272fea26752f3cd1198453 Mon Sep 17 00:00:00 2001 From: Timofey Boyko <55255132+TimofeyBoyko@users.noreply.github.com> Date: Tue, 27 Dec 2022 10:54:51 +0300 Subject: [PATCH 1/5] Web:Client:Home: fix sort by author for My documents --- packages/client/src/pages/Home/Section/Filter/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/client/src/pages/Home/Section/Filter/index.js b/packages/client/src/pages/Home/Section/Filter/index.js index 0c2d0cad41..0a03915b59 100644 --- a/packages/client/src/pages/Home/Section/Filter/index.js +++ b/packages/client/src/pages/Home/Section/Filter/index.js @@ -1132,7 +1132,7 @@ const SectionFilterContent = ({ ?.getItem(`${COLUMNS_SIZE_INFO_PANEL}=${userId}`) ?.split(" "); - if (availableSort?.includes("Author") && !isPersonalRoom) { + if (availableSort?.includes("Author")) { const idx = availableSort.findIndex((x) => x === "Author"); const hide = infoPanelVisible && From 42b1862e4b02a2a9465233043caa4828206aeb98 Mon Sep 17 00:00:00 2001 From: Timofey Boyko <55255132+TimofeyBoyko@users.noreply.github.com> Date: Tue, 27 Dec 2022 11:10:26 +0300 Subject: [PATCH 2/5] Web:Editor: fix empty toastr --- packages/editor/src/client/components/Editor.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/editor/src/client/components/Editor.js b/packages/editor/src/client/components/Editor.js index ce4f4448d0..37f6a4769a 100644 --- a/packages/editor/src/client/components/Editor.js +++ b/packages/editor/src/client/components/Editor.js @@ -104,7 +104,8 @@ function Editor({ ); } const errorText = typeof error === "string" ? error : error.errorMessage; - toastr.error(errorText); + + errorText && toastr.error(errorText); } }, [mfReady, error]); From 74f30f2d38c48b65e0873e171bd3734b64131d28 Mon Sep 17 00:00:00 2001 From: Elyor Djalilov Date: Tue, 27 Dec 2022 15:23:05 +0500 Subject: [PATCH 3/5] =?UTF-8?q?Fix=20Bug=C2=A060344?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TableView/sub-components/FileNameCell.js | 10 +--- .../client/src/store/ContextOptionsStore.js | 46 ++++++------------- .../client/src/store/FilesActionsStore.js | 45 ++++++++++++------ 3 files changed, 47 insertions(+), 54 deletions(-) diff --git a/packages/client/src/pages/Home/Section/Body/TableView/sub-components/FileNameCell.js b/packages/client/src/pages/Home/Section/Body/TableView/sub-components/FileNameCell.js index e6652ad493..cb03749703 100644 --- a/packages/client/src/pages/Home/Section/Body/TableView/sub-components/FileNameCell.js +++ b/packages/client/src/pages/Home/Section/Body/TableView/sub-components/FileNameCell.js @@ -1,5 +1,4 @@ import React from "react"; -import { inject, observer } from "mobx-react"; import Link from "@docspace/components/link"; import Checkbox from "@docspace/components/checkbox"; import TableCell from "@docspace/components/table-container/TableCell"; @@ -15,7 +14,6 @@ const FileNameCell = ({ theme, t, inProgress, - isLoading, }) => { const { title } = item; @@ -25,7 +23,7 @@ const FileNameCell = ({ return ( <> - {inProgress || isLoading ? ( + {inProgress ? ( { - return { - isLoading: filesActionsStore.isLoading, - }; -})(observer(FileNameCell)); +export default FileNameCell; diff --git a/packages/client/src/store/ContextOptionsStore.js b/packages/client/src/store/ContextOptionsStore.js index fca9db95d8..79740fa575 100644 --- a/packages/client/src/store/ContextOptionsStore.js +++ b/packages/client/src/store/ContextOptionsStore.js @@ -175,19 +175,10 @@ class ContextOptionsStore { setIsVerHistoryPanel(true); }; - finalizeVersion = async (id) => { - let timer = null; - try { - timer = setTimeout(() => { - this.filesActionsStore.setIsLoading(true); - }, 200); - await this.filesActionsStore.finalizeVersionAction(id); - } catch (err) { - toastr.error(err); - } finally { - this.filesActionsStore.setIsLoading(false); - clearTimeout(timer); - } + finalizeVersion = (id) => { + this.filesActionsStore + .finalizeVersionAction(id) + .catch((err) => toastr.error(err)); }; onClickFavorite = (e, id, t) => { @@ -204,30 +195,21 @@ class ContextOptionsStore { .catch((err) => toastr.error(err)); }; - lockFile = async (item, t) => { - let timer = null; + lockFile = (item, t) => { const { id, locked } = item; const { setSelection: setInfoPanelSelection, } = this.authStore.infoPanelStore; - try { - timer = setTimeout(() => { - this.filesActionsStore.setIsLoading(true); - }, 200); - await this.filesActionsStore - .lockFileAction(id, !locked) - .then(() => - locked - ? toastr.success(t("Translations:FileUnlocked")) - : toastr.success(t("Translations:FileLocked")) - ) - .then(() => setInfoPanelSelection({ ...item, locked: !locked })); - } catch (err) { - toastr.error(err); - } finally { - this.filesActionsStore.setIsLoading(false), clearTimeout(timer); - } + this.filesActionsStore + .lockFileAction(id, !locked) + .then(() => + locked + ? toastr.success(t("Translations:FileUnlocked")) + : toastr.success(t("Translations:FileLocked")) + ) + .then(() => setInfoPanelSelection({ ...item, locked: !locked })) + .catch((err) => toastr.error(err)); }; onClickLinkForPortal = (item, t) => { diff --git a/packages/client/src/store/FilesActionsStore.js b/packages/client/src/store/FilesActionsStore.js index 7e047f74cf..7f10782fa0 100644 --- a/packages/client/src/store/FilesActionsStore.js +++ b/packages/client/src/store/FilesActionsStore.js @@ -45,7 +45,6 @@ class FilesActionStore { itemOpenLocation = null; isLoadedLocationFiles = false; isLoadedSearchFiles = false; - isLoading = false; constructor( authStore, @@ -758,19 +757,41 @@ class FilesActionStore { .then(() => fetchFiles(this.selectedFolderStore.id, filter, true, true)); }; - lockFileAction = (id, locked) => { + lockFileAction = async (id, locked) => { + let timer = null; const { setFile } = this.filesStore; - return lockFile(id, locked).then((res) => setFile(res)); + try { + timer = setTimeout(() => { + this.filesStore.setActiveFiles([id]); + }, 200); + await lockFile(id, locked).then((res) => { + setFile(res), this.filesStore.setActiveFiles([]); + }); + } catch (err) { + toastr.error(err); + } finally { + clearTimeout(timer); + } }; - finalizeVersionAction = (id) => { + finalizeVersionAction = async (id) => { + let timer = null; const { setFile } = this.filesStore; - - return finalizeVersion(id, 0, false).then((res) => { - if (res && res[0]) { - setFile(res[0]); - } - }); + try { + timer = setTimeout(() => { + this.filesStore.setActiveFiles([id]); + }, 200); + await finalizeVersion(id, 0, false).then((res) => { + if (res && res[0]) { + setFile(res[0]); + this.filesStore.setActiveFiles([]); + } + }); + } catch (err) { + toastr.error(err); + } finally { + clearTimeout(timer); + } }; duplicateAction = (item, label) => { @@ -1102,10 +1123,6 @@ class FilesActionStore { this.isLoadedSearchFiles = isLoadedSearchFiles; }; - setIsLoading = (isLoading) => { - this.isLoading = isLoading; - }; - openLocationAction = async (locationId) => { this.setIsLoadedLocationFiles(false); this.filesStore.setBufferSelection(null); From 8cf3f74aff9a3db3725cd85b12946e6b9b18082d Mon Sep 17 00:00:00 2001 From: Alexey Safronov Date: Tue, 27 Dec 2022 13:45:47 +0300 Subject: [PATCH 4/5] Fix Bug 60353 - Accounts: Sign Up. Portal registration fails. (@self.json 401) --- packages/common/store/AuthStore.js | 15 ++++++++------- packages/common/store/UserStore.js | 6 +++++- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/packages/common/store/AuthStore.js b/packages/common/store/AuthStore.js index 27ddea25f9..dd14581dc0 100644 --- a/packages/common/store/AuthStore.js +++ b/packages/common/store/AuthStore.js @@ -53,14 +53,15 @@ class AuthStore { this.skipRequest = skipRequest; - try { - await this.userStore.init(); - } catch (e) { - console.error(e); - } + await this.settingsStore.init(); const requests = []; - requests.push(this.settingsStore.init()); + + if (this.settingsStore.isLoaded && this.settingsStore.socketUrl) { + requests.push(this.userStore.init()); + } else { + this.userStore.setIsLoaded(true); + } if (this.isAuthenticated && !skipRequest) { requests.push( @@ -222,7 +223,7 @@ class AuthStore { get isAuthenticated() { return ( - this.userStore.isAuthenticated || + (this.settingsStore.isLoaded && this.settingsStore.socketUrl) || //this.userStore.isAuthenticated || this.settingsStore.tenantStatus === TenantStatus.PortalRestore ); } diff --git a/packages/common/store/UserStore.js b/packages/common/store/UserStore.js index 7648bac332..3c439bb23b 100644 --- a/packages/common/store/UserStore.js +++ b/packages/common/store/UserStore.js @@ -31,7 +31,11 @@ class UserStore { this.setIsLoading(true); - await this.loadCurrentUser(); + try { + await this.loadCurrentUser(); + } catch (e) { + console.error(e); + } this.setIsLoading(false); this.setIsLoaded(true); From 5c828d4124ff7aed5241332349166b7829264720 Mon Sep 17 00:00:00 2001 From: SuhorukovAnton Date: Tue, 27 Dec 2022 13:49:07 +0300 Subject: [PATCH 5/5] upload .ico for favicon --- .../Api/Settings/WhitelabelController.cs | 10 ++++++++-- web/ASC.Web.Core/LogoUploader.cs | 9 +++++++-- web/ASC.Web.Core/Users/UserPhotoManager.cs | 4 ++-- .../WhiteLabel/TenantWhiteLabelSettings.cs | 13 +++++++------ 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/web/ASC.Web.Api/Api/Settings/WhitelabelController.cs b/web/ASC.Web.Api/Api/Settings/WhitelabelController.cs index c118c71297..80f7ccb491 100644 --- a/web/ASC.Web.Api/Api/Settings/WhitelabelController.cs +++ b/web/ASC.Web.Api/Api/Settings/WhitelabelController.cs @@ -81,8 +81,14 @@ public class WhitelabelController : BaseSettingsController var logoDict = new Dictionary>(); foreach (var l in inDto.Logo) - { - logoDict.Add(Int32.Parse(l.Key), new KeyValuePair(l.Value.Light, l.Value.Dark)); + { + var key = Int32.Parse(l.Key); + if (key == (int)WhiteLabelLogoTypeEnum.Favicon && !(l.Value.Light.EndsWith("ico") || l.Value.Light.EndsWith("svg"))) + { + throw new InvalidOperationException("Favicon must have .ico or .svg extension"); + } + + logoDict.Add(key, new KeyValuePair(l.Value.Light, l.Value.Dark)); } await _tenantWhiteLabelSettingsHelper.SetLogo(settings, logoDict, null); diff --git a/web/ASC.Web.Core/LogoUploader.cs b/web/ASC.Web.Core/LogoUploader.cs index 9fe167201e..308e9febb1 100644 --- a/web/ASC.Web.Core/LogoUploader.cs +++ b/web/ASC.Web.Core/LogoUploader.cs @@ -64,10 +64,15 @@ public class LogoUploader reader.Read(data, 0, (int)logo.Length); reader.Close(); - if (logo.ContentType.Contains("svg")) + if (logo.ContentType.Contains("image/x-icon")) { result.Success = true; - result.Message = await userPhotoManager.SaveTempSvg(data, setupInfo.MaxImageUploadSize); + result.Message = await userPhotoManager.SaveTempPhoto(data, setupInfo.MaxImageUploadSize, "ico"); + } + else if (logo.ContentType.Contains("image/svg+xml")) + { + result.Success = true; + result.Message = await userPhotoManager.SaveTempPhoto(data, setupInfo.MaxImageUploadSize, "svg"); } else { diff --git a/web/ASC.Web.Core/Users/UserPhotoManager.cs b/web/ASC.Web.Core/Users/UserPhotoManager.cs index cc8ba6ff90..ab88be1751 100644 --- a/web/ASC.Web.Core/Users/UserPhotoManager.cs +++ b/web/ASC.Web.Core/Users/UserPhotoManager.cs @@ -768,7 +768,7 @@ public class UserPhotoManager return (await store.SaveAsync(_tempDomainName, fileName, stream)).ToString(); } - public async Task SaveTempSvg(byte[] data, long maxFileSize) + public async Task SaveTempPhoto(byte[] data, long maxFileSize, string ext) { if (maxFileSize != -1 && data.Length > maxFileSize) { @@ -776,7 +776,7 @@ public class UserPhotoManager } using var stream = new MemoryStream(data); - var fileName = Guid.NewGuid() + ".svg"; + var fileName = Guid.NewGuid() + $".{ext}"; var store = GetDataStore(); return (await store.SaveAsync(_tempDomainName, fileName, stream)).ToString(); } diff --git a/web/ASC.Web.Core/WhiteLabel/TenantWhiteLabelSettings.cs b/web/ASC.Web.Core/WhiteLabel/TenantWhiteLabelSettings.cs index 3657c8a212..e51e1dfb17 100644 --- a/web/ASC.Web.Core/WhiteLabel/TenantWhiteLabelSettings.cs +++ b/web/ASC.Web.Core/WhiteLabel/TenantWhiteLabelSettings.cs @@ -562,7 +562,13 @@ public class TenantWhiteLabelSettingsHelper return partnerLogoPath; } - return _webImageSupplier.GetAbsoluteWebPath($"logo/" + BuildLogoFileName(type, "svg", dark)); + var ext = type switch + { + WhiteLabelLogoTypeEnum.Favicon => "ico", + _ => "svg" + }; + + return _webImageSupplier.GetAbsoluteWebPath($"logo/" + BuildLogoFileName(type, ext, dark)); } private async Task GetPartnerStorageLogoPath(WhiteLabelLogoTypeEnum type, bool dark) @@ -647,11 +653,6 @@ public class TenantWhiteLabelSettingsHelper return $"{(dark ? "dark_" : "")}{type.ToString().ToLowerInvariant()}.{fileExt}"; } - if (type == WhiteLabelLogoTypeEnum.Favicon) - { - return "favicon.ico"; - } - return $"{type.ToString().ToLowerInvariant()}.{fileExt}"; }