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 React from "react";
|
||||||
import { inject, observer } from "mobx-react";
|
|
||||||
import Link from "@docspace/components/link";
|
import Link from "@docspace/components/link";
|
||||||
import Checkbox from "@docspace/components/checkbox";
|
import Checkbox from "@docspace/components/checkbox";
|
||||||
import TableCell from "@docspace/components/table-container/TableCell";
|
import TableCell from "@docspace/components/table-container/TableCell";
|
||||||
@ -15,7 +14,6 @@ const FileNameCell = ({
|
|||||||
theme,
|
theme,
|
||||||
t,
|
t,
|
||||||
inProgress,
|
inProgress,
|
||||||
isLoading,
|
|
||||||
}) => {
|
}) => {
|
||||||
const { title } = item;
|
const { title } = item;
|
||||||
|
|
||||||
@ -25,7 +23,7 @@ const FileNameCell = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{inProgress || isLoading ? (
|
{inProgress ? (
|
||||||
<Loader
|
<Loader
|
||||||
className="table-container_row-loader"
|
className="table-container_row-loader"
|
||||||
type="oval"
|
type="oval"
|
||||||
@ -65,8 +63,4 @@ const FileNameCell = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default inject(({ filesActionsStore }) => {
|
export default FileNameCell;
|
||||||
return {
|
|
||||||
isLoading: filesActionsStore.isLoading,
|
|
||||||
};
|
|
||||||
})(observer(FileNameCell));
|
|
||||||
|
@ -1132,7 +1132,7 @@ const SectionFilterContent = ({
|
|||||||
?.getItem(`${COLUMNS_SIZE_INFO_PANEL}=${userId}`)
|
?.getItem(`${COLUMNS_SIZE_INFO_PANEL}=${userId}`)
|
||||||
?.split(" ");
|
?.split(" ");
|
||||||
|
|
||||||
if (availableSort?.includes("Author") && !isPersonalRoom) {
|
if (availableSort?.includes("Author")) {
|
||||||
const idx = availableSort.findIndex((x) => x === "Author");
|
const idx = availableSort.findIndex((x) => x === "Author");
|
||||||
const hide =
|
const hide =
|
||||||
infoPanelVisible &&
|
infoPanelVisible &&
|
||||||
|
@ -175,19 +175,10 @@ class ContextOptionsStore {
|
|||||||
setIsVerHistoryPanel(true);
|
setIsVerHistoryPanel(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
finalizeVersion = async (id) => {
|
finalizeVersion = (id) => {
|
||||||
let timer = null;
|
this.filesActionsStore
|
||||||
try {
|
.finalizeVersionAction(id)
|
||||||
timer = setTimeout(() => {
|
.catch((err) => toastr.error(err));
|
||||||
this.filesActionsStore.setIsLoading(true);
|
|
||||||
}, 200);
|
|
||||||
await this.filesActionsStore.finalizeVersionAction(id);
|
|
||||||
} catch (err) {
|
|
||||||
toastr.error(err);
|
|
||||||
} finally {
|
|
||||||
this.filesActionsStore.setIsLoading(false);
|
|
||||||
clearTimeout(timer);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
onClickFavorite = (e, id, t) => {
|
onClickFavorite = (e, id, t) => {
|
||||||
@ -204,30 +195,21 @@ class ContextOptionsStore {
|
|||||||
.catch((err) => toastr.error(err));
|
.catch((err) => toastr.error(err));
|
||||||
};
|
};
|
||||||
|
|
||||||
lockFile = async (item, t) => {
|
lockFile = (item, t) => {
|
||||||
let timer = null;
|
|
||||||
const { id, locked } = item;
|
const { id, locked } = item;
|
||||||
const {
|
const {
|
||||||
setSelection: setInfoPanelSelection,
|
setSelection: setInfoPanelSelection,
|
||||||
} = this.authStore.infoPanelStore;
|
} = this.authStore.infoPanelStore;
|
||||||
|
|
||||||
try {
|
this.filesActionsStore
|
||||||
timer = setTimeout(() => {
|
.lockFileAction(id, !locked)
|
||||||
this.filesActionsStore.setIsLoading(true);
|
.then(() =>
|
||||||
}, 200);
|
locked
|
||||||
await this.filesActionsStore
|
? toastr.success(t("Translations:FileUnlocked"))
|
||||||
.lockFileAction(id, !locked)
|
: toastr.success(t("Translations:FileLocked"))
|
||||||
.then(() =>
|
)
|
||||||
locked
|
.then(() => setInfoPanelSelection({ ...item, locked: !locked }))
|
||||||
? toastr.success(t("Translations:FileUnlocked"))
|
.catch((err) => toastr.error(err));
|
||||||
: toastr.success(t("Translations:FileLocked"))
|
|
||||||
)
|
|
||||||
.then(() => setInfoPanelSelection({ ...item, locked: !locked }));
|
|
||||||
} catch (err) {
|
|
||||||
toastr.error(err);
|
|
||||||
} finally {
|
|
||||||
this.filesActionsStore.setIsLoading(false), clearTimeout(timer);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
onClickLinkForPortal = (item, t) => {
|
onClickLinkForPortal = (item, t) => {
|
||||||
|
@ -45,7 +45,6 @@ class FilesActionStore {
|
|||||||
itemOpenLocation = null;
|
itemOpenLocation = null;
|
||||||
isLoadedLocationFiles = false;
|
isLoadedLocationFiles = false;
|
||||||
isLoadedSearchFiles = false;
|
isLoadedSearchFiles = false;
|
||||||
isLoading = false;
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
authStore,
|
authStore,
|
||||||
@ -758,19 +757,41 @@ class FilesActionStore {
|
|||||||
.then(() => fetchFiles(this.selectedFolderStore.id, filter, true, true));
|
.then(() => fetchFiles(this.selectedFolderStore.id, filter, true, true));
|
||||||
};
|
};
|
||||||
|
|
||||||
lockFileAction = (id, locked) => {
|
lockFileAction = async (id, locked) => {
|
||||||
|
let timer = null;
|
||||||
const { setFile } = this.filesStore;
|
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;
|
const { setFile } = this.filesStore;
|
||||||
|
try {
|
||||||
return finalizeVersion(id, 0, false).then((res) => {
|
timer = setTimeout(() => {
|
||||||
if (res && res[0]) {
|
this.filesStore.setActiveFiles([id]);
|
||||||
setFile(res[0]);
|
}, 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) => {
|
duplicateAction = (item, label) => {
|
||||||
@ -1102,10 +1123,6 @@ class FilesActionStore {
|
|||||||
this.isLoadedSearchFiles = isLoadedSearchFiles;
|
this.isLoadedSearchFiles = isLoadedSearchFiles;
|
||||||
};
|
};
|
||||||
|
|
||||||
setIsLoading = (isLoading) => {
|
|
||||||
this.isLoading = isLoading;
|
|
||||||
};
|
|
||||||
|
|
||||||
openLocationAction = async (locationId) => {
|
openLocationAction = async (locationId) => {
|
||||||
this.setIsLoadedLocationFiles(false);
|
this.setIsLoadedLocationFiles(false);
|
||||||
this.filesStore.setBufferSelection(null);
|
this.filesStore.setBufferSelection(null);
|
||||||
|
@ -53,14 +53,15 @@ class AuthStore {
|
|||||||
|
|
||||||
this.skipRequest = skipRequest;
|
this.skipRequest = skipRequest;
|
||||||
|
|
||||||
try {
|
await this.settingsStore.init();
|
||||||
await this.userStore.init();
|
|
||||||
} catch (e) {
|
|
||||||
console.error(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
const requests = [];
|
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) {
|
if (this.isAuthenticated && !skipRequest) {
|
||||||
requests.push(
|
requests.push(
|
||||||
@ -222,7 +223,7 @@ class AuthStore {
|
|||||||
|
|
||||||
get isAuthenticated() {
|
get isAuthenticated() {
|
||||||
return (
|
return (
|
||||||
this.userStore.isAuthenticated ||
|
(this.settingsStore.isLoaded && this.settingsStore.socketUrl) || //this.userStore.isAuthenticated ||
|
||||||
this.settingsStore.tenantStatus === TenantStatus.PortalRestore
|
this.settingsStore.tenantStatus === TenantStatus.PortalRestore
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,11 @@ class UserStore {
|
|||||||
|
|
||||||
this.setIsLoading(true);
|
this.setIsLoading(true);
|
||||||
|
|
||||||
await this.loadCurrentUser();
|
try {
|
||||||
|
await this.loadCurrentUser();
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
|
|
||||||
this.setIsLoading(false);
|
this.setIsLoading(false);
|
||||||
this.setIsLoaded(true);
|
this.setIsLoaded(true);
|
||||||
|
@ -104,7 +104,8 @@ function Editor({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
const errorText = typeof error === "string" ? error : error.errorMessage;
|
const errorText = typeof error === "string" ? error : error.errorMessage;
|
||||||
toastr.error(errorText);
|
|
||||||
|
errorText && toastr.error(errorText);
|
||||||
}
|
}
|
||||||
}, [mfReady, error]);
|
}, [mfReady, error]);
|
||||||
|
|
||||||
|
@ -82,7 +82,13 @@ public class WhitelabelController : BaseSettingsController
|
|||||||
|
|
||||||
foreach (var l in inDto.Logo)
|
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);
|
await _tenantWhiteLabelSettingsHelper.SetLogo(settings, logoDict, null);
|
||||||
|
@ -64,10 +64,15 @@ public class LogoUploader
|
|||||||
reader.Read(data, 0, (int)logo.Length);
|
reader.Read(data, 0, (int)logo.Length);
|
||||||
reader.Close();
|
reader.Close();
|
||||||
|
|
||||||
if (logo.ContentType.Contains("svg"))
|
if (logo.ContentType.Contains("image/x-icon"))
|
||||||
{
|
{
|
||||||
result.Success = true;
|
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
|
else
|
||||||
{
|
{
|
||||||
|
@ -768,7 +768,7 @@ public class UserPhotoManager
|
|||||||
return (await store.SaveAsync(_tempDomainName, fileName, stream)).ToString();
|
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)
|
if (maxFileSize != -1 && data.Length > maxFileSize)
|
||||||
{
|
{
|
||||||
@ -776,7 +776,7 @@ public class UserPhotoManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
using var stream = new MemoryStream(data);
|
using var stream = new MemoryStream(data);
|
||||||
var fileName = Guid.NewGuid() + ".svg";
|
var fileName = Guid.NewGuid() + $".{ext}";
|
||||||
var store = GetDataStore();
|
var store = GetDataStore();
|
||||||
return (await store.SaveAsync(_tempDomainName, fileName, stream)).ToString();
|
return (await store.SaveAsync(_tempDomainName, fileName, stream)).ToString();
|
||||||
}
|
}
|
||||||
|
@ -562,7 +562,13 @@ public class TenantWhiteLabelSettingsHelper
|
|||||||
return partnerLogoPath;
|
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)
|
private async Task<string> GetPartnerStorageLogoPath(WhiteLabelLogoTypeEnum type, bool dark)
|
||||||
@ -647,11 +653,6 @@ public class TenantWhiteLabelSettingsHelper
|
|||||||
return $"{(dark ? "dark_" : "")}{type.ToString().ToLowerInvariant()}.{fileExt}";
|
return $"{(dark ? "dark_" : "")}{type.ToString().ToLowerInvariant()}.{fileExt}";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == WhiteLabelLogoTypeEnum.Favicon)
|
|
||||||
{
|
|
||||||
return "favicon.ico";
|
|
||||||
}
|
|
||||||
|
|
||||||
return $"{type.ToString().ToLowerInvariant()}.{fileExt}";
|
return $"{type.ToString().ToLowerInvariant()}.{fileExt}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user