Merge branch 'release/rc-v1.2.0' into feature/form-links

This commit is contained in:
Maksim Chegulov 2022-12-21 14:12:10 +03:00
commit c3d4a78cf0
10 changed files with 79 additions and 44 deletions

View File

@ -31,7 +31,7 @@ public class TenantStatusFilter : IResourceFilter
{
private readonly TenantManager _tenantManager;
private readonly ILogger<TenantStatusFilter> _logger;
private readonly string[] _passthroughtRequestEndings = new[] { "preparation-portal", "getrestoreprogress", "settings", "settings.json" }; //TODO add or update when "preparation-portal" will be done
private readonly string[] _passthroughtRequestEndings = new[] { "preparation-portal", "getrestoreprogress", "settings", "settings.json", "colortheme.json", "logos.json", "build.json", "@self.json" }; //TODO add or update when "preparation-portal" will be done
public TenantStatusFilter(ILogger<TenantStatusFilter> logger, TenantManager tenantManager)

View File

@ -38,19 +38,19 @@ public class RedisCacheNotify<T> : ICacheNotify<T> where T : IMessage<T>, new()
public void Publish(T obj, CacheNotifyAction action)
{
Task.Run(() => _redis.PublishAsync(GetChannelName(action), new RedisCachePubSubItem<T>() { Object = obj, Action = action }))
Task.Run(async () => await _redis.PublishAsync(GetChannelName(action), new RedisCachePubSubItem<T>() { Object = obj, Action = action }))
.GetAwaiter()
.GetResult();
}
public async Task PublishAsync(T obj, CacheNotifyAction action)
{
await Task.Run(() => _redis.PublishAsync(GetChannelName(action), new RedisCachePubSubItem<T>() { Object = obj, Action = action }));
await Task.Run(async () => await _redis.PublishAsync(GetChannelName(action), new RedisCachePubSubItem<T>() { Object = obj, Action = action }));
}
public void Subscribe(Action<T> onchange, CacheNotifyAction action)
{
Task.Run(() => _redis.SubscribeAsync<RedisCachePubSubItem<T>>(GetChannelName(action), (i) =>
Task.Run(async () => await _redis.SubscribeAsync<RedisCachePubSubItem<T>>(GetChannelName(action), (i) =>
{
onchange(i.Object);
@ -61,7 +61,7 @@ public class RedisCacheNotify<T> : ICacheNotify<T> where T : IMessage<T>, new()
public void Unsubscribe(CacheNotifyAction action)
{
Task.Run(() => _redis.UnsubscribeAsync<RedisCachePubSubItem<T>>(GetChannelName(action), (i) =>
Task.Run(async () => await _redis.UnsubscribeAsync<RedisCachePubSubItem<T>>(GetChannelName(action), (i) =>
{
return Task.FromResult(true);
})).GetAwaiter()

View File

@ -254,7 +254,7 @@ public class TariffService : ITariffService
}
}
if (tariffId.HasValue)
if (tariffId.HasValue && tariffId.Value != 0)
{
_notify.Publish(new TariffCacheItem { TenantId = tenantId, TariffId = tariffId.Value }, CacheNotifyAction.Insert);
}

View File

@ -56,7 +56,7 @@ export default function withQuickButtons(WrappedComponent) {
isAdmin,
sectionWidth,
viewAs,
isPersonalRoom,
folderCategory,
} = this.props;
const quickButtonsComponent = (
@ -71,7 +71,7 @@ export default function withQuickButtons(WrappedComponent) {
isCanWebEdit={isCanWebEdit}
onClickLock={this.onClickLock}
onClickFavorite={this.onClickFavorite}
isPersonalRoom={isPersonalRoom}
folderCategory={folderCategory}
/>
);
@ -97,9 +97,16 @@ export default function withQuickButtons(WrappedComponent) {
setFavoriteAction,
onSelectItem,
} = filesActionsStore;
const { isPersonalRoom } = treeFoldersStore;
const {
isPersonalFolderRoot,
isArchiveFolderRoot,
isTrashFolder,
} = treeFoldersStore;
const { setSharingPanelVisible } = dialogsStore;
const folderCategory =
isTrashFolder || isArchiveFolderRoot || isPersonalFolderRoot;
return {
theme: auth.settingsStore.theme,
isAdmin: auth.isAdmin,
@ -107,8 +114,7 @@ export default function withQuickButtons(WrappedComponent) {
setFavoriteAction,
onSelectItem,
setSharingPanelVisible,
isPersonalRoom,
folderCategory,
};
}
)(observer(WithQuickButtons));

View File

@ -6,6 +6,9 @@ import { Encoder } from "@docspace/common/utils/encoder";
import api from "@docspace/common/api";
const EditRoomEvent = ({
addActiveItems,
setActiveFolders,
visible,
onClose,
item,
@ -95,6 +98,8 @@ const EditRoomEvent = ({
logo: { big: item.logo.small },
});
addActiveItems(null, [room.id]);
await uploadRoomLogo(uploadLogoData).then((response) => {
const url = URL.createObjectURL(roomParams.icon.uploadedFile);
const img = new Image();
@ -113,6 +118,8 @@ const EditRoomEvent = ({
reloadSelection();
URL.revokeObjectURL(img.src);
setActiveFolders([]);
};
img.src = url;
});
@ -197,6 +204,8 @@ export default inject(
setFolder,
addLogoToRoom,
removeLogoFromRoom,
addActiveItems,
setActiveFolders,
} = filesStore;
const { createTag, fetchTags } = tagsStore;
@ -207,6 +216,9 @@ export default inject(
const { withPaging } = auth.settingsStore;
const { reloadSelection } = auth.infoPanelStore;
return {
addActiveItems,
setActiveFolders,
editRoom,
addTagsToRoom,
removeTagsFromRoom,

View File

@ -14,6 +14,14 @@ const StyledIcon = styled.img`
border-radius: 6px;
outline: 1px solid ${(props) => props.theme.itemIcon.borderColor};
`}
${(props) =>
props.isHidden &&
css`
display: none;
border-radius: none;
outline: none;
`}
`;
StyledIcon.defaultProps = { theme: Base };
@ -28,33 +36,30 @@ const EncryptedFileIcon = styled.div`
`;
const ItemIcon = ({ icon, fileExst, isPrivacy, isRoom, defaultRoomIcon }) => {
let isMount = true;
const [showDefaultIcon, setShowDefaultIcon] = React.useState(isRoom);
const [imgSrc, setImgSrc] = React.useState(defaultRoomIcon);
const onLoadRoomIcon = () => {
if (!isRoom || defaultRoomIcon === icon) return;
const fetchImage = async () => {
const res = await fetch(icon);
const imageBlob = await res.blob();
const imageObjectURL = URL.createObjectURL(imageBlob);
isMount && setImgSrc(imageObjectURL);
setShowDefaultIcon(false);
};
React.useEffect(() => {
if (!isRoom || icon === defaultRoomIcon) return;
fetchImage();
return () => {
isMount = false;
};
}, []);
return (
<>
{isRoom && (
<StyledIcon
className={`react-svg-icon`}
isHidden={!showDefaultIcon}
isRoom={isRoom}
src={defaultRoomIcon}
/>
)}
<StyledIcon
className={`react-svg-icon`}
isHidden={showDefaultIcon}
isRoom={isRoom}
src={!isRoom || icon === defaultRoomIcon ? icon : imgSrc}
src={icon}
onLoad={onLoadRoomIcon}
/>
{isPrivacy && fileExst && <EncryptedFileIcon isEdit={false} />}
</>

View File

@ -16,13 +16,14 @@ const QuickButtons = (props) => {
item,
theme,
sectionWidth,
isTrashFolder,
onClickLock,
isDisabled,
onClickFavorite,
viewAs,
isCanWebEdit,
isPersonalRoom,
folderCategory,
} = props;
const { id, locked, fileStatus, title, fileExst } = item;
@ -58,7 +59,7 @@ const QuickButtons = (props) => {
const setFavorite = () => onClickFavorite(isFavorite);
const isAvailableLockFile =
!isPersonalRoom && fileExst && displayBadges && isCanWebEdit;
!folderCategory && fileExst && displayBadges && isCanWebEdit;
return (
<div className="badges additional-badges">

View File

@ -180,12 +180,12 @@ const StyledSimpleFilesRow = styled(Row)`
}
.expandButton {
margin-left: ${(props) => (!props.isPersonalRoom ? "6px" : "0")};
margin-left: ${(props) => (!props.folderCategory ? "6px" : "0")};
padding-top: 0px;
}
.expandButton > div:first-child {
${(props) =>
props.isPersonalRoom &&
props.folderCategory &&
css`
padding-left: 0 !important;
`}
@ -220,7 +220,8 @@ const SimpleFilesRow = (props) => {
showHotkeyBorder,
id,
isRooms,
isPersonalRoom,
folderCategory,
} = props;
const [isDragOver, setIsDragOver] = React.useState(false);
@ -316,7 +317,7 @@ const SimpleFilesRow = (props) => {
isDragOver={isDragOver}
isSmallContainer={isSmallContainer}
isRooms={isRooms}
isPersonalRoom={isPersonalRoom}
folderCategory={folderCategory}
>
<FilesRowContent
item={item}

View File

@ -203,6 +203,10 @@ class TreeFoldersStore {
return FolderType.Archive === this.selectedFolderStore.rootFolderType;
}
get isPersonalFolderRoot() {
return FolderType.USER === this.selectedFolderStore.rootFolderType;
}
get selectedKeys() {
const selectedKeys =
this.selectedTreeNode.length > 0 &&

View File

@ -68,7 +68,8 @@ public class AuthenticationController : ControllerBase
private readonly UserManagerWrapper _userManagerWrapper;
private readonly TfaAppAuthSettingsHelper _tfaAppAuthSettingsHelper;
private readonly EmailValidationKeyProvider _emailValidationKeyProvider;
private readonly BruteForceLoginManager _bruteForceLoginManager;
private readonly BruteForceLoginManager _bruteForceLoginManager;
private readonly ILogger<AuthenticationController> _logger;
public AuthenticationController(
UserManager userManager,
@ -104,7 +105,8 @@ public class AuthenticationController : ControllerBase
DbLoginEventsManager dbLoginEventsManager,
BruteForceLoginManager bruteForceLoginManager,
TfaAppAuthSettingsHelper tfaAppAuthSettingsHelper,
EmailValidationKeyProvider emailValidationKeyProvider)
EmailValidationKeyProvider emailValidationKeyProvider,
ILogger<AuthenticationController> logger)
{
_userManager = userManager;
_tenantManager = tenantManager;
@ -140,6 +142,7 @@ public class AuthenticationController : ControllerBase
_bruteForceLoginManager = bruteForceLoginManager;
_tfaAppAuthSettingsHelper = tfaAppAuthSettingsHelper;
_emailValidationKeyProvider = emailValidationKeyProvider;
_logger = logger;
}
[AllowNotPayment]
@ -197,12 +200,13 @@ public class AuthenticationController : ControllerBase
return result;
}
catch
catch (Exception ex)
{
_messageService.Send(user.DisplayUserName(false, _displayUserSettingsHelper), sms
? MessageAction.LoginFailViaApiSms
: MessageAction.LoginFailViaApiTfa,
_messageTarget.Create(user.Id));
_messageTarget.Create(user.Id));
_logger.ErrorWithException(ex);
throw new AuthenticationException("User authentication failed");
}
finally
@ -279,9 +283,10 @@ public class AuthenticationController : ControllerBase
Expires = new ApiDateTime(_tenantManager, _timeZoneConverter, expires)
};
}
catch
catch (Exception ex)
{
_messageService.Send(user.DisplayUserName(false, _displayUserSettingsHelper), viaEmail ? MessageAction.LoginFailViaApi : MessageAction.LoginFailViaApiSocialAccount);
_messageService.Send(user.DisplayUserName(false, _displayUserSettingsHelper), viaEmail ? MessageAction.LoginFailViaApi : MessageAction.LoginFailViaApiSocialAccount);
_logger.ErrorWithException(ex);
throw new AuthenticationException("User authentication failed");
}
finally
@ -437,9 +442,10 @@ public class AuthenticationController : ControllerBase
_messageService.Send(!string.IsNullOrEmpty(inDto.UserName) ? inDto.UserName : AuditResource.EmailNotSpecified, MessageAction.LoginFailBruteForce);
throw new AuthenticationException("Login Fail. Too many attempts");
}
catch
catch (Exception ex)
{
_messageService.Send(!string.IsNullOrEmpty(inDto.UserName) ? inDto.UserName : AuditResource.EmailNotSpecified, action);
_messageService.Send(!string.IsNullOrEmpty(inDto.UserName) ? inDto.UserName : AuditResource.EmailNotSpecified, action);
_logger.ErrorWithException(ex);
throw new AuthenticationException("User authentication failed");
}
wrapper.UserInfo = user;