itizawa 5 лет назад
Родитель
Сommit
ed8ac186a6

+ 2 - 4
src/client/js/components/ComparePathsTable.jsx

@@ -8,12 +8,9 @@ import PageContainer from '../services/PageContainer';
 import { convertToNewAffiliationPath } from '../../../lib/util/path-utils';
 
 function ComparePathsTable(props) {
-  const { subordinatedPages, pageContainer } = props;
+  const { subordinatedPages, pageContainer, newPagePath } = props;
   const { path } = pageContainer.state;
 
-  // Dummy
-  const newPagePath = 'huga';
-
   return (
     <table className="table table-bordered">
       <tbody>
@@ -65,6 +62,7 @@ ComparePathsTable.propTypes = {
 
   pageContainer: PropTypes.instanceOf(PageContainer).isRequired,
   subordinatedPages: PropTypes.array.isRequired,
+  newPagePath: PropTypes.string.isRequired,
 };
 
 

+ 1 - 1
src/client/js/components/PageDuplicateModal.jsx

@@ -153,7 +153,7 @@ const PageDuplicateModal = (props) => {
             { t('modal_duplicate.label.Duplicate with child') }
           </label>
         </div>
-        {isDuplicateRecursively && <ComparePathsTable subordinatedPages={subordinatedPages} />}
+        {isDuplicateRecursively && <ComparePathsTable subordinatedPages={subordinatedPages} newPagePath={pageNameInput} />}
 
         {isDuplicateRecursively && (
           <div className="custom-control custom-checkbox custom-checkbox-warning">

+ 1 - 1
src/lib/util/path-utils.js

@@ -59,7 +59,7 @@ const userPageRoot = (user) => {
  */
 const convertToNewAffiliationPath = (oldPath, newPath, childPath) => {
   const pathRegExp = new RegExp(`^${escapeStringRegexp(oldPath)}`, 'i');
-  return `/${childPath.replace(pathRegExp, newPath)}`;
+  return childPath.replace(pathRegExp, newPath);
 };
 
 module.exports = {