2
0
Эх сурвалжийг харах

36 wip: update ok , re-rednering not yet

Mao 4 жил өмнө
parent
commit
837edd1450

+ 3 - 3
packages/app/src/client/services/PageContainer.js

@@ -343,10 +343,10 @@ export default class PageContainer extends Container {
     }
   }
 
-  // TODO : takes tagsRelation/tags models or date
-  updateStateAfterTagAdded() {
+  // TODO : temporaly use only
+  updateStateAfterTagAdded(page) {
     const newState = {
-      updatedAt: new Date().getTime(),
+      updatedAt: page.updatedAt,
     };
     this.setState(newState);
   }

+ 2 - 1
packages/app/src/components/Page/TagLabels.jsx

@@ -50,6 +50,7 @@ class TagLabels extends React.Component {
     } = this.props;
 
     const { pageId, revisionId } = pageContainer.state;
+    const options = editorContainer.getCurrentOptionsToSave;
     // It will not be reflected in the DB until the page is refreshed
     if (editorMode === 'edit') {
       return editorContainer.setState({ tags: newTags });
@@ -57,7 +58,7 @@ class TagLabels extends React.Component {
 
     try {
       const { tags } = await appContainer.apiPost('/tags.update', {
-        pageId, tags: newTags, revisionId,
+        pageId, tags: newTags, revisionId, options,
       });
 
       // update pageContainer.state

+ 2 - 4
packages/app/src/server/routes/tag.js

@@ -145,17 +145,15 @@ module.exports = function(crowi, app) {
     const tagEvent = crowi.event('tag');
     const pageId = req.body.pageId;
     const tags = req.body.tags;
+    const options = req.body.options;
     const revisionId = req.body.revisionId;
 
     const result = {};
     try {
       // TODO GC-1921 consider permission
-      // do Page.updatePage
       const page = await Page.findById(pageId);
       const previousRevision = await Revision.findById(revisionId);
-      // no difference than before, just updating page to have pages 'updatedAt' updated
-      const user = await User.findById('613eda3717b2d80c4874dfb7');
-      await Page.updatePage(page, previousRevision.body, previousRevision.body, user, {});
+      await Page.updatePage(page, previousRevision.body, previousRevision.body, req.user, options);
       await PageTagRelation.updatePageTags(pageId, tags);
       result.tags = await PageTagRelation.listTagNamesByPage(pageId);