From 7539d3767249d1144b233e456bb6aa21ea268204 Mon Sep 17 00:00:00 2001 From: Tatiana Lopaeva Date: Mon, 13 Nov 2023 14:33:36 +0300 Subject: [PATCH] fix Bug 64059 - Web: VersionHistory: Fixed display of the previous comment after restoring the version. --- .../VersionHistory/Section/Body/VersionRow.js | 30 +++++++++++-------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/packages/client/src/pages/VersionHistory/Section/Body/VersionRow.js b/packages/client/src/pages/VersionHistory/Section/Body/VersionRow.js index bd27cf3d21..a68340d809 100644 --- a/packages/client/src/pages/VersionHistory/Section/Body/VersionRow.js +++ b/packages/client/src/pages/VersionHistory/Section/Body/VersionRow.js @@ -9,7 +9,6 @@ import Text from "@docspace/components/text"; import Box from "@docspace/components/box"; import Textarea from "@docspace/components/textarea"; import Button from "@docspace/components/button"; -import ModalDialog from "@docspace/components/modal-dialog"; import { withTranslation } from "react-i18next"; import VersionBadge from "./VersionBadge"; import { StyledVersionRow } from "./StyledVersionHistory"; @@ -37,7 +36,7 @@ const VersionRow = (props) => { culture, isVersion, t, - markAsVersion, + // markAsVersion, restoreVersion, updateCommentVersion, onSetRestoreProcess, @@ -51,21 +50,28 @@ const VersionRow = (props) => { onClose, setIsVisible, } = props; + + const navigate = useNavigate(); + const [showEditPanel, setShowEditPanel] = useState(false); const [commentValue, setCommentValue] = useState(info.comment); const [isSavingComment, setIsSavingComment] = useState(false); - const navigate = useNavigate(); + useEffect(() => { + if (commentValue !== info.comment) { + setCommentValue(info.comment); + } + }, [info.comment]); const versionDate = `${moment(info.updated) .locale(culture) .format("L, LTS")}`; - const title = `${Encoder.htmlDecode(info.updatedBy?.displayName)}`; - const linkStyles = { isHovered: true, type: "action" }; + const title = `${Encoder.htmlDecode(info.updatedBy?.displayName)}`; const onDownloadAction = () => window.open(`${info.viewUrl}&version=${info.version}`, "_self"); + const onEditComment = () => !isEditing && setShowEditPanel(!showEditPanel); const onChange = (e) => { @@ -113,11 +119,11 @@ const VersionRow = (props) => { }); }; - const onVersionClick = () => { - markAsVersion(info.id, isVersion, info.version).catch((err) => - toastr.error(err) - ); - }; + // const onVersionClick = () => { + // markAsVersion(info.id, isVersion, info.version).catch((err) => + // toastr.error(err) + // ); + // }; const contextOptions = [ { @@ -289,7 +295,7 @@ export default inject(({ auth, versionHistoryStore, selectedFolderStore }) => { const language = (user && user.cultureName) || culture || "en"; const { - markAsVersion, + // markAsVersion, restoreVersion, updateCommentVersion, isEditing, @@ -304,7 +310,7 @@ export default inject(({ auth, versionHistoryStore, selectedFolderStore }) => { theme: auth.settingsStore.theme, culture: language, isTabletView, - markAsVersion, + // markAsVersion, restoreVersion, updateCommentVersion, isEditing: isEdit,