Merge branch 'develop' into feature/oauth2-client

This commit is contained in:
Timofey Boyko 2024-02-09 13:05:17 +03:00
commit 8b828f9e2a
11 changed files with 69 additions and 57 deletions

View File

@ -43,7 +43,9 @@ const AvatarEditorDialog = (props) => {
const { visible, onClose, profile, updateCreatedAvatar, setHasAvatar } =
props;
const [avatar, setAvatar] = useState({
uploadedFile: profile.hasAvatar ? profile.avatarMax : DefaultUserAvatarMax,
uploadedFile: profile.hasAvatar
? profile.avatarOriginal
: DefaultUserAvatarMax,
x: 0.5,
y: 0.5,
zoom: 1,
@ -63,7 +65,6 @@ const AvatarEditorDialog = (props) => {
onClose();
return;
}
const file = await dataUrlToFile(preview);
const avatarData = new FormData();

View File

@ -35,28 +35,26 @@ export default function withLoader(WrappedComponent) {
type === "EmpInvite") &&
!passwordSettings
) {
axios
.all([getSettings(), getPortalPasswordSettings(confirmHeader)])
.catch((error) => {
let errorMessage = "";
if (typeof error === "object") {
errorMessage =
error?.response?.data?.error?.message ||
error?.statusText ||
error?.message ||
"";
} else {
errorMessage = error;
}
getPortalPasswordSettings(confirmHeader).catch((error) => {
let errorMessage = "";
if (typeof error === "object") {
errorMessage =
error?.response?.data?.error?.message ||
error?.statusText ||
error?.message ||
"";
} else {
errorMessage = error;
}
console.error(errorMessage);
navigate(
combineUrl(
window.DocSpaceConfig?.proxy?.url,
`/login/error?message=${errorMessage}`
)
);
});
console.error(errorMessage);
navigate(
combineUrl(
window.DocSpaceConfig?.proxy?.url,
`/login/error?message=${errorMessage}`,
),
);
});
}
}, [passwordSettings]);
@ -77,8 +75,8 @@ export default function withLoader(WrappedComponent) {
navigate(
combineUrl(
window.DocSpaceConfig?.proxy?.url,
`/login/error?message=${errorMessage}`
)
`/login/error?message=${errorMessage}`,
),
);
});
}

View File

@ -22,8 +22,8 @@ const SsoComboBox = (props) => {
const currentOption =
options.find((option) => option.key === value) || options[0];
const onSelect = () => {
setComboBox(currentOption, name);
const onSelect = (option) => {
setComboBox(option, name);
};
return (

View File

@ -84,14 +84,15 @@ class TargetUserStore {
};
updateCreatedAvatar = (avatar) => {
const { big, small, medium, max } = avatar;
const { big, small, medium, max, main } = avatar;
this.targetUser.avatar = big;
this.targetUser.avatarSmall = small;
this.targetUser.avatarMedium = medium;
this.targetUser.avatarMax = max;
this.targetUser.avatarOriginal = main;
this.userStore.updateAvatarInfo(big, small, medium, max);
this.userStore.updateAvatarInfo(big, small, medium, max, main);
console.log("updateCreatedAvatar", {
targetUser: this.targetUser,
@ -138,7 +139,7 @@ class TargetUserStore {
isEnableBadges,
isEnableRoomsActivity,
isEnableDailyFeed,
isEnableTips
isEnableTips,
) => {
this.badgesSubscription = isEnableBadges;
this.roomsActivitySubscription = isEnableRoomsActivity;

View File

@ -15,6 +15,7 @@ export type TUser = {
workFrom: string;
avatarMax: string;
avatarMedium: string;
avatarOriginal: string;
avatar: string;
isAdmin: boolean;
isRoomAdmin: boolean;

View File

@ -541,6 +541,14 @@ const StyledSortButton = styled.div<{ viewAs: TViewAs; isDesc: boolean }>`
.icon-button_svg {
cursor: pointer;
}
:hover {
border-color: ${(props) => props.theme.iconButton.color};
svg {
path {
fill: ${(props) => props.theme.iconButton.hoverColor};
}
}
}
}
.sort-combo-box {

View File

@ -70,9 +70,12 @@ const Dropzone = ({
throw new Error("recursion depth exceeded");
}
return new Promise(() => {
resizeRecursiveAsync(img, canvas, compressionRatio + 1, depth + 1);
});
return new Promise((resolve) => {
// eslint-disable-next-line no-promise-executor-return
return resolve(file);
}).then(() =>
resizeRecursiveAsync(img, canvas, compressionRatio + 1, depth + 1),
);
}
const onDrop = async ([file]: [File]) => {

View File

@ -67,11 +67,6 @@ const Navigation = ({
const isDesktop = currentDeviceType === DeviceType.desktop;
const infoPanelIsVisible = React.useMemo(
() => isDesktop && (!isEmptyPage || (isEmptyPage && isRoom)),
[isDesktop, isEmptyPage, isRoom],
);
const toggleDropBox = useCallback(() => {
if (navigationItems?.length === 0) return;
if (isRootFolder) return setIsOpen(false);
@ -263,7 +258,7 @@ const Navigation = ({
isEmptyPage={isEmptyPage}
/>
</StyledContainer>
{infoPanelIsVisible && !hideInfoPanel && (
{isDesktop && !hideInfoPanel && (
<ToggleInfoPanelButton
id="info-panel-toggle--open"
isRootFolder={isRootFolder}
@ -279,3 +274,4 @@ const Navigation = ({
};
export default React.memo(Navigation);

View File

@ -171,42 +171,42 @@ const PasswordInput = React.forwardRef(
const specSymbolsRegExp = new RegExp(
passwordSettings.specSymbolsRegexStr || "",
);
const allowedRegExp = new RegExp(
`^${passwordSettings.allowedCharactersRegexStr}{1,}$`,
);
let capital;
let digits;
let special;
let capital = true;
let digits = true;
let special = true;
let allowed = true;
let length = true;
if (passwordSettings.upperCase) {
capital = capitalRegExp.test(value);
} else {
capital = true;
}
if (passwordSettings.digits) {
digits = digitalRegExp.test(value);
} else {
digits = true;
}
if (passwordSettings.specSymbols) {
special = specSymbolsRegExp.test(value);
} else {
special = true;
}
const allowedCharacters = allowedRegExp.test(value);
if (passwordSettings.allowedCharactersRegexStr) {
const allowedRegExp = new RegExp(
`^${passwordSettings.allowedCharactersRegexStr}{1,}$`,
);
allowed = allowedRegExp.test(value);
}
if (passwordSettings?.minLength !== undefined) {
length = value.trim().length >= passwordSettings.minLength;
}
return {
allowed: allowedCharacters,
allowed,
digits,
capital,
special,
length: passwordSettings.minLength
? value.trim().length >= passwordSettings.minLength
: true,
length,
};
}
return {} as TPasswordValidation;
@ -597,3 +597,4 @@ export { PasswordInput };
// PasswordInput.displayName = "PasswordInput";
// export { PasswordInput };

View File

@ -186,7 +186,7 @@ class SettingsStore {
limitedAccessSpace = null;
passwordSettings: TPasswordSettings = {} as TPasswordSettings;
passwordSettings: TPasswordSettings | null = null;
hasShortenService = false;
@ -1100,3 +1100,4 @@ class SettingsStore {
}
export { SettingsStore };

View File

@ -126,6 +126,7 @@ class UserStore {
avatarSmall: string,
avatarMedium: string,
avatarMax: string,
avatarOriginal: string,
) => {
if (this.user) {
this.user = {
@ -134,6 +135,7 @@ class UserStore {
avatarSmall,
avatarMedium,
avatarMax,
avatarOriginal,
};
}
};