Merge branch 'release/v1.2' of github.com:ONLYOFFICE/AppServer into release/v1.2
This commit is contained in:
commit
212fc5a405
@ -16,6 +16,8 @@ const themes = {
|
||||
Base: Base,
|
||||
};
|
||||
|
||||
const isDesktopEditors = window["AscDesktopEditor"] !== undefined;
|
||||
|
||||
class SettingsStore {
|
||||
isLoading = false;
|
||||
isLoaded = false;
|
||||
@ -27,7 +29,11 @@ class SettingsStore {
|
||||
currentProductId = "";
|
||||
culture = "en";
|
||||
cultures = [];
|
||||
theme = Base;
|
||||
theme = isDesktopEditors
|
||||
? window.RendererProcessVariable?.theme?.type === "dark"
|
||||
? Dark
|
||||
: Base
|
||||
: Base;
|
||||
trustedDomains = [];
|
||||
trustedDomainsType = 0;
|
||||
timezone = "UTC";
|
||||
@ -66,7 +72,7 @@ class SettingsStore {
|
||||
guestCaption: "Guest",
|
||||
guestsCaption: "Guests",
|
||||
};
|
||||
isDesktopClient = window["AscDesktopEditor"] !== undefined;
|
||||
isDesktopClient = isDesktopEditors;
|
||||
//isDesktopEncryption: desktopEncryption;
|
||||
isEncryptionSupport = false;
|
||||
encryptionKeys = null;
|
||||
|
@ -12,12 +12,13 @@ import {
|
||||
StyledButtonWrapper,
|
||||
StyledButtonOptions,
|
||||
StyledAlertIcon,
|
||||
StyledRenderItem,
|
||||
} from "./styled-main-button";
|
||||
import IconButton from "../icon-button";
|
||||
import Button from "../button";
|
||||
import Text from "../text";
|
||||
import Scrollbar from "@appserver/components/scrollbar";
|
||||
import { isMobile } from "react-device-detect";
|
||||
import { isIOS, isMobile } from "react-device-detect";
|
||||
import Backdrop from "../backdrop";
|
||||
|
||||
import styled from "styled-components";
|
||||
@ -126,6 +127,52 @@ const MainButtonMobile = (props) => {
|
||||
}
|
||||
}, [opened]);
|
||||
|
||||
let currentPosition, prevPosition, buttonBackground, scrollElem;
|
||||
|
||||
useEffect(() => {
|
||||
if (!isIOS) return;
|
||||
|
||||
scrollElem = document.getElementsByClassName("section-scroll")[0];
|
||||
|
||||
if (scrollElem?.scrollTop === 0) {
|
||||
scrollElem.classList.add("dialog-background-scroll");
|
||||
}
|
||||
|
||||
scrollElem?.addEventListener("scroll", scrollChangingBackground);
|
||||
|
||||
return () => {
|
||||
scrollElem?.removeEventListener("scroll", scrollChangingBackground);
|
||||
};
|
||||
}, []);
|
||||
|
||||
const scrollChangingBackground = () => {
|
||||
currentPosition = scrollElem.scrollTop;
|
||||
const scrollHeight = scrollElem.scrollHeight;
|
||||
|
||||
if (currentPosition < prevPosition) {
|
||||
setDialogBackground(scrollHeight);
|
||||
} else {
|
||||
if (currentPosition > 0 && currentPosition > prevPosition) {
|
||||
setButtonBackground();
|
||||
}
|
||||
}
|
||||
prevPosition = currentPosition;
|
||||
};
|
||||
|
||||
const setDialogBackground = (scrollHeight) => {
|
||||
if (!buttonBackground) {
|
||||
document
|
||||
.getElementsByClassName("section-scroll")[0]
|
||||
.classList.add("dialog-background-scroll");
|
||||
}
|
||||
if (currentPosition < scrollHeight / 3) {
|
||||
buttonBackground = false;
|
||||
}
|
||||
};
|
||||
const setButtonBackground = () => {
|
||||
buttonBackground = true;
|
||||
scrollElem.classList.remove("dialog-background-scroll");
|
||||
};
|
||||
const recalculateHeight = () => {
|
||||
let height =
|
||||
divRef?.current?.getBoundingClientRect()?.height || window.innerHeight;
|
||||
@ -175,7 +222,7 @@ const MainButtonMobile = (props) => {
|
||||
|
||||
const renderItems = () => {
|
||||
return (
|
||||
<div ref={divRef}>
|
||||
<StyledRenderItem ref={divRef}>
|
||||
<StyledContainerAction>
|
||||
{actionOptions.map((option) => {
|
||||
const optionOnClickAction = () => {
|
||||
@ -240,7 +287,7 @@ const MainButtonMobile = (props) => {
|
||||
)
|
||||
: ""}
|
||||
</StyledButtonOptions>
|
||||
</div>
|
||||
</StyledRenderItem>
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -65,6 +65,18 @@ const mobileDropDown = css`
|
||||
|
||||
right: ${(props) => props.theme.mainButtonMobile.dropDown.mobile.right};
|
||||
bottom: ${(props) => props.theme.mainButtonMobile.dropDown.mobile.bottom};
|
||||
|
||||
.dialog-background-scroll {
|
||||
background: ${(props) => props.theme.backgroundColor} !important;
|
||||
}
|
||||
.section-scroll {
|
||||
background: ${(props) =>
|
||||
props.theme.mainButtonMobile.buttonOptions.backgroundColor};
|
||||
}
|
||||
`;
|
||||
|
||||
const StyledRenderItem = styled.div`
|
||||
background: ${(props) => props.theme.backgroundColor};
|
||||
`;
|
||||
|
||||
const StyledDropDown = styled(DropDown)`
|
||||
@ -281,4 +293,5 @@ export {
|
||||
StyledButtonWrapper,
|
||||
StyledButtonOptions,
|
||||
StyledAlertIcon,
|
||||
StyledRenderItem,
|
||||
};
|
||||
|
@ -311,10 +311,18 @@ namespace ASC.Web.Files.Services.DocumentService
|
||||
foreach (var user in fileData.Users)
|
||||
{
|
||||
if (!Guid.TryParse(user, out var userId))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(user) && user.StartsWith("uid-"))
|
||||
{
|
||||
userId = Guid.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Info("DocService userId is not Guid: " + user);
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
users.Remove(userId);
|
||||
|
||||
try
|
||||
|
@ -1179,21 +1179,26 @@ namespace ASC.Web.Files.Utils
|
||||
var editLink = check.EditLink;
|
||||
var file = check.File;
|
||||
if (file == null)
|
||||
{
|
||||
file = await fileDao.GetFileAsync(fileId);
|
||||
}
|
||||
|
||||
if (file == null) throw new FileNotFoundException(FilesCommonResource.ErrorMassage_FileNotFound);
|
||||
var fileSecurity = FileSecurity;
|
||||
if (!Equals(userId, Guid.Empty))
|
||||
{
|
||||
if (!editLink
|
||||
&& (!await fileSecurity.CanEditAsync(file, userId)
|
||||
&& !await fileSecurity.CanCustomFilterEditAsync(file, userId)
|
||||
&& !await fileSecurity.CanReviewAsync(file, userId)
|
||||
&& !await fileSecurity.CanFillFormsAsync(file, userId)
|
||||
&& !await fileSecurity.CanCommentAsync(file, userId)
|
||||
&& (!await FileSecurity.CanEditAsync(file, userId)
|
||||
&& !await FileSecurity.CanCustomFilterEditAsync(file, userId)
|
||||
&& !await FileSecurity.CanReviewAsync(file, userId)
|
||||
&& !await FileSecurity.CanFillFormsAsync(file, userId)
|
||||
&& !await FileSecurity.CanCommentAsync(file, userId)
|
||||
|| UserManager.GetUsers(userId).IsVisitor(UserManager)))
|
||||
{
|
||||
throw new SecurityException(FilesCommonResource.ErrorMassage_SecurityException_EditFile);
|
||||
}
|
||||
if (await FileLockedForMeAsync(file.ID, userId)) throw new Exception(FilesCommonResource.ErrorMassage_LockedFile);
|
||||
}
|
||||
|
||||
if (file.RootFolderType == FolderType.TRASH) throw new Exception(FilesCommonResource.ErrorMassage_ViewTrashItem);
|
||||
|
||||
checkRight = FileTracker.ProlongEditing(fileId, tabId, userId, editingAlone);
|
||||
|
@ -607,7 +607,11 @@ const ShellWrapper = inject(({ auth, backup }) => {
|
||||
setTheme,
|
||||
roomsMode,
|
||||
setSnackbarExist,
|
||||
userTheme: auth?.userStore?.user?.theme,
|
||||
userTheme: isDesktopClient
|
||||
? window.RendererProcessVariable?.theme?.type === "dark"
|
||||
? "Dark"
|
||||
: "Base"
|
||||
: auth?.userStore?.user?.theme,
|
||||
};
|
||||
})(observer(Shell));
|
||||
|
||||
|
@ -80,8 +80,15 @@ export const getPasswordErrorMessage = (t, settings) => {
|
||||
};
|
||||
|
||||
export const useThemeDetector = () => {
|
||||
const isDesktopClient = window["AscDesktopEditor"] !== undefined;
|
||||
const [systemTheme, setSystemTheme] = useState(
|
||||
window.matchMedia("(prefers-color-scheme: dark)").matches ? "Dark" : "Base"
|
||||
isDesktopClient
|
||||
? window.RendererProcessVariable?.theme?.type === "dark"
|
||||
? "Dark"
|
||||
: "Base"
|
||||
: window.matchMedia("(prefers-color-scheme: dark)").matches
|
||||
? "Dark"
|
||||
: "Base"
|
||||
);
|
||||
|
||||
const systemThemeListener = (e) => {
|
||||
@ -89,9 +96,16 @@ export const useThemeDetector = () => {
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (isDesktopClient) return;
|
||||
|
||||
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
||||
mediaQuery.addListener(systemThemeListener);
|
||||
return () => mediaQuery.removeListener(systemThemeListener);
|
||||
|
||||
return () => {
|
||||
if (isDesktopClient) return;
|
||||
|
||||
mediaQuery.removeListener(systemThemeListener);
|
||||
};
|
||||
}, []);
|
||||
|
||||
return systemTheme;
|
||||
|
Loading…
Reference in New Issue
Block a user