From 58e6f839c117299114e487eebeb6ea5d128c7d67 Mon Sep 17 00:00:00 2001 From: Timofey Boyko <55255132+TimofeyBoyko@users.noreply.github.com> Date: Wed, 21 Dec 2022 11:01:20 +0300 Subject: [PATCH 1/5] Web:Client:EditRoomEvent: add room at active items while logo is loading --- .../src/components/GlobalEvents/EditRoomEvent.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/client/src/components/GlobalEvents/EditRoomEvent.js b/packages/client/src/components/GlobalEvents/EditRoomEvent.js index 84eaf33153..beb5ddc550 100644 --- a/packages/client/src/components/GlobalEvents/EditRoomEvent.js +++ b/packages/client/src/components/GlobalEvents/EditRoomEvent.js @@ -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, From 7c910ca78fd639dec80c7fe666f292b732604673 Mon Sep 17 00:00:00 2001 From: Tatiana Lopaeva Date: Wed, 21 Dec 2022 11:21:01 +0300 Subject: [PATCH 2/5] Fixed Bug 60257: Files. Lock icon for files in 'My Documents'/'Archive'/'Trash' folder. --- packages/client/src/HOCs/withQuickButtons.js | 16 +++++++++++----- packages/client/src/components/QuickButtons.js | 7 ++++--- .../Home/Section/Body/RowsView/SimpleFilesRow.js | 9 +++++---- packages/client/src/store/TreeFoldersStore.js | 4 ++++ 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/packages/client/src/HOCs/withQuickButtons.js b/packages/client/src/HOCs/withQuickButtons.js index 94080fa046..edb3d0b7b5 100644 --- a/packages/client/src/HOCs/withQuickButtons.js +++ b/packages/client/src/HOCs/withQuickButtons.js @@ -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)); diff --git a/packages/client/src/components/QuickButtons.js b/packages/client/src/components/QuickButtons.js index f9f735b428..a01d63b925 100644 --- a/packages/client/src/components/QuickButtons.js +++ b/packages/client/src/components/QuickButtons.js @@ -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 (
diff --git a/packages/client/src/pages/Home/Section/Body/RowsView/SimpleFilesRow.js b/packages/client/src/pages/Home/Section/Body/RowsView/SimpleFilesRow.js index 63cec9c9f7..6a61ecc530 100644 --- a/packages/client/src/pages/Home/Section/Body/RowsView/SimpleFilesRow.js +++ b/packages/client/src/pages/Home/Section/Body/RowsView/SimpleFilesRow.js @@ -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} > 0 && From d4aaa4afaf6447240922f1a993a1c5989f3d0750 Mon Sep 17 00:00:00 2001 From: SuhorukovAnton Date: Wed, 21 Dec 2022 12:19:47 +0300 Subject: [PATCH 3/5] fix Bug 60194 - Settings: Restore. When trying to restore the docspace portal crashes with multiple errors in the console --- common/ASC.Api.Core/Middleware/TenantStatusFilter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/ASC.Api.Core/Middleware/TenantStatusFilter.cs b/common/ASC.Api.Core/Middleware/TenantStatusFilter.cs index 973abcace0..66ccdf5fa1 100644 --- a/common/ASC.Api.Core/Middleware/TenantStatusFilter.cs +++ b/common/ASC.Api.Core/Middleware/TenantStatusFilter.cs @@ -31,7 +31,7 @@ public class TenantStatusFilter : IResourceFilter { private readonly TenantManager _tenantManager; private readonly ILogger _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 logger, TenantManager tenantManager) From 029c10ddd70491eac87218106c9e85dfbd8591c7 Mon Sep 17 00:00:00 2001 From: Timofey Boyko <55255132+TimofeyBoyko@users.noreply.github.com> Date: Wed, 21 Dec 2022 12:34:04 +0300 Subject: [PATCH 4/5] Web:Client:ItemIcon: remove blob src --- packages/client/src/components/ItemIcon.js | 41 ++++++++++++---------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/packages/client/src/components/ItemIcon.js b/packages/client/src/components/ItemIcon.js index eb235f3ed9..991f784ca4 100644 --- a/packages/client/src/components/ItemIcon.js +++ b/packages/client/src/components/ItemIcon.js @@ -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 && ( + + )} {isPrivacy && fileExst && } From a1daacb4d0436fc4a656dcb5a60001872e649f01 Mon Sep 17 00:00:00 2001 From: pavelbannov Date: Wed, 21 Dec 2022 12:38:47 +0300 Subject: [PATCH 5/5] fix --- common/ASC.Common/Caching/RedisCacheNotify.cs | 8 +++---- .../ASC.Core.Common/Billing/TariffService.cs | 2 +- .../Api/AuthenticationController.cs | 22 ++++++++++++------- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/common/ASC.Common/Caching/RedisCacheNotify.cs b/common/ASC.Common/Caching/RedisCacheNotify.cs index fbe238c3d3..159440a13c 100644 --- a/common/ASC.Common/Caching/RedisCacheNotify.cs +++ b/common/ASC.Common/Caching/RedisCacheNotify.cs @@ -38,19 +38,19 @@ public class RedisCacheNotify : ICacheNotify where T : IMessage, new() public void Publish(T obj, CacheNotifyAction action) { - Task.Run(() => _redis.PublishAsync(GetChannelName(action), new RedisCachePubSubItem() { Object = obj, Action = action })) + Task.Run(async () => await _redis.PublishAsync(GetChannelName(action), new RedisCachePubSubItem() { Object = obj, Action = action })) .GetAwaiter() .GetResult(); } public async Task PublishAsync(T obj, CacheNotifyAction action) { - await Task.Run(() => _redis.PublishAsync(GetChannelName(action), new RedisCachePubSubItem() { Object = obj, Action = action })); + await Task.Run(async () => await _redis.PublishAsync(GetChannelName(action), new RedisCachePubSubItem() { Object = obj, Action = action })); } public void Subscribe(Action onchange, CacheNotifyAction action) { - Task.Run(() => _redis.SubscribeAsync>(GetChannelName(action), (i) => + Task.Run(async () => await _redis.SubscribeAsync>(GetChannelName(action), (i) => { onchange(i.Object); @@ -61,7 +61,7 @@ public class RedisCacheNotify : ICacheNotify where T : IMessage, new() public void Unsubscribe(CacheNotifyAction action) { - Task.Run(() => _redis.UnsubscribeAsync>(GetChannelName(action), (i) => + Task.Run(async () => await _redis.UnsubscribeAsync>(GetChannelName(action), (i) => { return Task.FromResult(true); })).GetAwaiter() diff --git a/common/ASC.Core.Common/Billing/TariffService.cs b/common/ASC.Core.Common/Billing/TariffService.cs index d521bc777f..6b54dc660a 100644 --- a/common/ASC.Core.Common/Billing/TariffService.cs +++ b/common/ASC.Core.Common/Billing/TariffService.cs @@ -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); } diff --git a/web/ASC.Web.Api/Api/AuthenticationController.cs b/web/ASC.Web.Api/Api/AuthenticationController.cs index 06c68c032b..3cb94b5cc6 100644 --- a/web/ASC.Web.Api/Api/AuthenticationController.cs +++ b/web/ASC.Web.Api/Api/AuthenticationController.cs @@ -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 _logger; public AuthenticationController( UserManager userManager, @@ -104,7 +105,8 @@ public class AuthenticationController : ControllerBase DbLoginEventsManager dbLoginEventsManager, BruteForceLoginManager bruteForceLoginManager, TfaAppAuthSettingsHelper tfaAppAuthSettingsHelper, - EmailValidationKeyProvider emailValidationKeyProvider) + EmailValidationKeyProvider emailValidationKeyProvider, + ILogger 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;