diff --git a/common/services/ASC.ApiSystem/Classes/CommonMethods.cs b/common/services/ASC.ApiSystem/Classes/CommonMethods.cs index e1ba6521bc..3d5819c8aa 100644 --- a/common/services/ASC.ApiSystem/Classes/CommonMethods.cs +++ b/common/services/ASC.ApiSystem/Classes/CommonMethods.cs @@ -92,9 +92,9 @@ public class CommonMethods }; } - public string CreateReference(string requestUriScheme, string tenantDomain, string email, bool first = false, string module = "", bool sms = false) + public string CreateReference(int tenantId,string requestUriScheme, string tenantDomain, string email, bool first = false, string module = "", bool sms = false) { - var url = _commonLinkUtility.GetConfirmationUrlRelative(email, ConfirmType.Auth, (first ? "true" : "") + module + (sms ? "true" : "")); + var url = _commonLinkUtility.GetConfirmationUrlRelative(tenantId, email, ConfirmType.Auth, (first ? "true" : "") + module + (sms ? "true" : "")); return $"{requestUriScheme}{Uri.SchemeDelimiter}{tenantDomain}/{url}{(first ? "&first=true" : "")}{(string.IsNullOrEmpty(module) ? "" : "&module=" + module)}{(sms ? "&sms=true" : "")}"; } diff --git a/common/services/ASC.ApiSystem/Controllers/PortalController.cs b/common/services/ASC.ApiSystem/Controllers/PortalController.cs index d0183a6f4c..d1a5e44865 100644 --- a/common/services/ASC.ApiSystem/Controllers/PortalController.cs +++ b/common/services/ASC.ApiSystem/Controllers/PortalController.cs @@ -309,26 +309,17 @@ public class PortalController : ControllerBase } } - try + var reference = _commonMethods.CreateReference(t.Id, Request.Scheme, t.GetTenantDomain(_coreSettings), info.Email, isFirst); + _log.LogDebug("PortalName = {0}; Elapsed ms. CreateReferenceByCookie...: {1}", model.PortalName, sw.ElapsedMilliseconds); + + sw.Stop(); + + return Ok(new { - _log.LogDebug("try CreateReference"); - var reference = _commonMethods.CreateReference(Request.Scheme, t.GetTenantDomain(_coreSettings), info.Email, isFirst); - _log.LogDebug("PortalName = {0}; Elapsed ms. CreateReferenceByCookie...: {1}", model.PortalName, sw.ElapsedMilliseconds); - - sw.Stop(); - - return Ok(new - { - reference, - tenant = _commonMethods.ToTenantWrapper(t), - referenceWelcome = sendCongratulationsAddress - }); - }catch (Exception e) - { - _log.LogError(e, "CreateReference error"); - - return BadRequest(error); - } + reference, + tenant = _commonMethods.ToTenantWrapper(t), + referenceWelcome = sendCongratulationsAddress + }); } [HttpDelete("remove")] diff --git a/packages/client/public/locales/en/ArchiveDialog.json b/packages/client/public/locales/en/ArchiveDialog.json new file mode 100644 index 0000000000..b08bfba8f6 --- /dev/null +++ b/packages/client/public/locales/en/ArchiveDialog.json @@ -0,0 +1,8 @@ +{ + "ArchiveHeader": "Move to Archived?", + "ArchiveRoom": "You are about to archive a room.", + "ArchiveRooms": "You are about to archive rooms.", + "RestoreRoom": "Are you sure you want to restore room?", + "RestoreRooms": "Are you sure you want to restore rooms?", + "RestoreAllRooms": "Are you sure you want to restore all rooms?" +} diff --git a/packages/client/public/locales/en/DeleteDialog.json b/packages/client/public/locales/en/DeleteDialog.json index 665877e1d8..a021fa25e8 100644 --- a/packages/client/public/locales/en/DeleteDialog.json +++ b/packages/client/public/locales/en/DeleteDialog.json @@ -1,4 +1,6 @@ { + "DeleteRoom": "You are about to delete this room? You won’t be able to restore her.", + "DeleteRooms": "You are about to delete these rooms? You won’t be able to restore it.", "MoveToTrashButton": "Move to Trash", "MoveToTrashFile": "You are about to delete this file? Please note, that if you have shared it with someone, it will become unavailable. Are you sure you want to continue?", "MoveToTrashFolder": "You are about to delete this folder? Please note, that if you have shared it with someone, it will become unavailable. Are you sure you want to continue?", diff --git a/packages/client/public/locales/en/Files.json b/packages/client/public/locales/en/Files.json index 35fd8d4801..4c5a979884 100644 --- a/packages/client/public/locales/en/Files.json +++ b/packages/client/public/locales/en/Files.json @@ -1,6 +1,6 @@ { "All": "All", - "Archived": "Archived", + "Archived": "Move to archive", "ArchiveAction": "Empty archive", "ArchivedRoomAction": "The room '{{name}}' is archived", "ArchivedRoomsAction": "The rooms are archived", @@ -94,7 +94,6 @@ "RoomRemoved": "Room removed", "RoomsRemoved": "Rooms removed", "RestoreAll": "Restore all", - "RestoreAllArchive": "Are you sure you want to restore all rooms?", "SearchByContent": "Search by file contents", "SendByEmail": "Send by email", "Share": "Share", diff --git a/packages/client/src/HOCs/withHotkeys.js b/packages/client/src/HOCs/withHotkeys.js index 56f84d4d66..a8c92f14d5 100644 --- a/packages/client/src/HOCs/withHotkeys.js +++ b/packages/client/src/HOCs/withHotkeys.js @@ -55,7 +55,7 @@ const withHotkeys = (Component) => { isVisitor, deleteRooms, - moveRoomsToArchive, + archiveRooms, } = props; const hotkeysFilter = { @@ -260,7 +260,7 @@ const withHotkeys = (Component) => { } if (isRoomsFolder) { - isAvailableOption("archive") && moveRoomsToArchive(t); + isAvailableOption("archive") && archiveRooms("archive"); return; } @@ -394,7 +394,7 @@ const withHotkeys = (Component) => { backToParentFolder, setFavoriteAction, deleteRooms, - moveRoomsToArchive, + archiveRooms, } = filesActionsStore; const { visible: mediaViewerIsVisible } = mediaViewerDataStore; @@ -456,7 +456,7 @@ const withHotkeys = (Component) => { isVisitor, deleteRooms, - moveRoomsToArchive, + archiveRooms, }; } )(observer(WithHotkeys)); diff --git a/packages/client/src/components/FilesPanels/index.js b/packages/client/src/components/FilesPanels/index.js index 7842e3b2a5..513f2abab1 100644 --- a/packages/client/src/components/FilesPanels/index.js +++ b/packages/client/src/components/FilesPanels/index.js @@ -26,7 +26,7 @@ import { InviteUsersWarningDialog, } from "../dialogs"; import ConvertPasswordDialog from "../dialogs/ConvertPasswordDialog"; -import RestoreAllArchiveDialog from "../dialogs/RestoreAllArchiveDialog"; +import ArchiveDialog from "../dialogs/ArchiveDialog"; const Panels = (props) => { const { @@ -54,7 +54,7 @@ const Panels = (props) => { convertPasswordDialogVisible, createRoomDialogVisible, restoreAllPanelVisible, - restoreAllArchiveDialogVisible, + archiveDialogVisible, inviteUsersWarningDialogVisible, } = props; @@ -121,9 +121,7 @@ const Panels = (props) => { convertPasswordDialogVisible && ( ), - restoreAllArchiveDialogVisible && ( - - ), + archiveDialogVisible && , inviteUsersWarningDialogVisible && ( ), @@ -151,7 +149,7 @@ export default inject( convertPasswordDialogVisible, connectItem, //TODO: restoreAllPanelVisible, - restoreAllArchiveDialogVisible, + archiveDialogVisible, createMasterForm, selectFileDialogVisible, @@ -189,7 +187,7 @@ export default inject( hotkeyPanelVisible, restoreAllPanelVisible, invitePanelVisible: invitePanelOptions.visible, - restoreAllArchiveDialogVisible, + archiveDialogVisible, inviteUsersWarningDialogVisible, }; } diff --git a/packages/client/src/components/dialogs/RestoreAllArchiveDialog/index.js b/packages/client/src/components/dialogs/ArchiveDialog/index.js similarity index 50% rename from packages/client/src/components/dialogs/RestoreAllArchiveDialog/index.js rename to packages/client/src/components/dialogs/ArchiveDialog/index.js index dfd78a440f..cf500671f3 100644 --- a/packages/client/src/components/dialogs/RestoreAllArchiveDialog/index.js +++ b/packages/client/src/components/dialogs/ArchiveDialog/index.js @@ -17,16 +17,21 @@ const StyledModal = styled(ModalDialogContainer)` } `; -const RestoreAllArchiveDialogComponent = (props) => { +const ArchiveDialogComponent = (props) => { const { - visible, t, tReady, - setRestoreAllArchiveDialogVisible, + visible, + restoreAll, + action, + + setArchiveDialogVisible, + setRestoreAllArchive, + setArchiveActionType, setArchiveAction, - folders, + items, } = props; const [requestRunning, setRequestRunning] = React.useState(false); @@ -38,13 +43,17 @@ const RestoreAllArchiveDialogComponent = (props) => { }, []); const onClose = () => { - !requestRunning && setRestoreAllArchiveDialogVisible(false); + if (!requestRunning) { + setRestoreAllArchive(false); + setArchiveActionType(null); + setArchiveDialogVisible(false); + } }; - const onRestore = () => { + const onAction = () => { setRequestRunning(true); - setArchiveAction("unarchive", folders, t).then(() => { + setArchiveAction(action, items, t).then(() => { setRequestRunning(false); onClose(); }); @@ -52,10 +61,34 @@ const RestoreAllArchiveDialogComponent = (props) => { const onKeyPress = (e) => { if (e.keyCode === 13) { - onRestore(); + onAction(); } }; + const getDescription = () => { + if (restoreAll) return t("ArchiveDialog:RestoreAllRooms"); + + if (action === "archive") { + return items.length > 1 + ? `${t("ArchiveDialog:ArchiveRooms")} ${t("Common:WantToContinue")}` + : `${t("ArchiveDialog:ArchiveRoom")} ${t("Common:WantToContinue")}`; + } + + if (action === "unarchive") { + return items.length > 1 + ? t("ArchiveDialog:RestoreRooms") + : t("ArchiveDialog:RestoreRoom"); + } + }; + + const header = + action === "archive" + ? t("ArchiveDialog:ArchiveHeader") + : t("Common:Restore"); + const description = getDescription(); + const acceptButton = + action === "archive" ? t("Common:OKButton") : t("Common:Restore"); + return ( { onClose={onClose} displayType="modal" > - {t("Common:Restore")} + {header} - {t("RestoreAllArchive")} + {description}