Merge branch 'release/rc-v1.2.0' of github.com:ONLYOFFICE/AppServer into release/rc-v1.2.0
This commit is contained in:
commit
fc52606db3
@ -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 ? (
|
||||
<Loader
|
||||
className="table-container_row-loader"
|
||||
type="oval"
|
||||
@ -65,8 +63,4 @@ const FileNameCell = ({
|
||||
);
|
||||
};
|
||||
|
||||
export default inject(({ filesActionsStore }) => {
|
||||
return {
|
||||
isLoading: filesActionsStore.isLoading,
|
||||
};
|
||||
})(observer(FileNameCell));
|
||||
export default FileNameCell;
|
||||
|
@ -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 &&
|
||||
|
@ -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) => {
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -104,7 +104,8 @@ function Editor({
|
||||
);
|
||||
}
|
||||
const errorText = typeof error === "string" ? error : error.errorMessage;
|
||||
toastr.error(errorText);
|
||||
|
||||
errorText && toastr.error(errorText);
|
||||
}
|
||||
}, [mfReady, error]);
|
||||
|
||||
|
@ -81,8 +81,14 @@ public class WhitelabelController : BaseSettingsController
|
||||
var logoDict = new Dictionary<int, KeyValuePair<string, string>>();
|
||||
|
||||
foreach (var l in inDto.Logo)
|
||||
{
|
||||
logoDict.Add(Int32.Parse(l.Key), new KeyValuePair<string, string>(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<string, string>(l.Value.Light, l.Value.Dark));
|
||||
}
|
||||
|
||||
await _tenantWhiteLabelSettingsHelper.SetLogo(settings, logoDict, null);
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -768,7 +768,7 @@ public class UserPhotoManager
|
||||
return (await store.SaveAsync(_tempDomainName, fileName, stream)).ToString();
|
||||
}
|
||||
|
||||
public async Task<string> SaveTempSvg(byte[] data, long maxFileSize)
|
||||
public async Task<string> 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();
|
||||
}
|
||||
|
@ -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<string> 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}";
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user