Просмотр исходного кода

remove conflict revisions from serverside

yuto-oweseek 4 лет назад
Родитель
Сommit
344d5a0993

+ 0 - 6
packages/app/src/components/SavePageControls.jsx

@@ -49,12 +49,6 @@ class SavePageControls extends React.Component {
     catch (error) {
       logger.error('failed to save', error);
       pageContainer.showErrorToastr(error);
-      if (error.code === 'conflict') {
-        pageContainer.setState({
-          isConflictingOnSave: true,
-          revisionsOnConflict: error.data,
-        });
-      }
     }
   }
 

+ 1 - 29
packages/app/src/server/routes/page.js

@@ -831,35 +831,7 @@ module.exports = function(crowi, app) {
     const Revision = crowi.model('Revision');
     let page = await Page.findByIdAndViewer(pageId, req.user);
     if (page != null && revisionId != null && !page.isUpdatable(revisionId)) {
-      const populatedFields = 'name imageUrlCached';
-      // when isUpdatable is false, originRevisionId is a reqested revisionId
-      const originRevision = await Revision.findById(revisionId).populate('author', populatedFields);
-      const latestRevision = await Revision.findById(page.revision).populate('author', populatedFields);
-
-      const revisions = {};
-
-      revisions.request = {
-        revisionId: '',
-        revisionBody: pageBody,
-        createdAt: new Date(),
-        userName: req.user.name,
-        userImgPath: req.user.imageUrlCached,
-      };
-      revisions.origin = {
-        revisionId: originRevision._id.toString(),
-        revisionBody: originRevision.body,
-        createdAt: originRevision.createdAt,
-        userName: originRevision.author.name,
-        userImgPath: originRevision.author.imageUrlCached,
-      };
-      revisions.latest = {
-        revisionId: latestRevision._id.toString(),
-        revisionBody: latestRevision.body,
-        createdAt: latestRevision.createdAt,
-        userName: latestRevision.author.name,
-        userImgPath: latestRevision.author.imageUrlCached,
-      };
-      return res.json(ApiResponse.error('Posted param "revisionId" is outdated.', 'conflict', revisions));
+      return res.json(ApiResponse.error('Posted param "revisionId" is outdated.', 'conflict'));
     }
 
     const options = { isSyncRevisionToHackmd };