Mao 4 лет назад
Родитель
Сommit
b80ccde389

+ 4 - 5
packages/app/src/client/services/PageContainer.js

@@ -345,11 +345,10 @@ export default class PageContainer extends Container {
 
   // TODO : takes tagsRelation/tags models or date
   updateStateAfterTagAdded() {
-    // const newState = {
-    //   updatedAt: new Date().getTime(),
-    // };
-    // console.log(`date is :${newState.updatedAt}`);
-    // this.setState(newState);
+    const newState = {
+      updatedAt: new Date().getTime(),
+    };
+    this.setState(newState);
   }
 
   /**

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

@@ -55,10 +55,8 @@ class TagLabels extends React.Component {
     if (editorMode === 'edit') {
       return editorContainer.setState({ tags: newTags });
     }
-    // const newUpdatedAt;
     try {
-      const { tags, updatedAt } = await appContainer.apiPost('/tags.update', { pageId, tags: newTags });
-      // newUpdatedAt = updatedAt;
+      const { tags } = await appContainer.apiPost('/tags.update', { pageId, tags: newTags });
       // update pageContainer.state
       pageContainer.setState({ tags });
       // update editorContainer.state

+ 0 - 2
packages/app/src/server/models/page-tag-relation.js

@@ -25,8 +25,6 @@ const schema = new mongoose.Schema({
     ref: 'Tag',
     required: true,
   },
-  created: { type: Date, default: Date.now },
-  updated: { type: Date, default: Date.now },
 });
 // define unique compound index
 schema.index({ relatedPage: 1, relatedTag: 1 }, { unique: true });

+ 1 - 6
packages/app/src/server/routes/tag.js

@@ -140,18 +140,13 @@ module.exports = function(crowi, app) {
     const tagEvent = crowi.event('tag');
     const pageId = req.body.pageId;
     const tags = req.body.tags;
-    // TODO : あとで消す
-    // console.log(`tag is : ${tags}`); // thisistag,another-tag,new-tag
+
     const result = {};
     try {
       // TODO GC-1921 consider permission
       const page = await Page.findById(pageId);
       await PageTagRelation.updatePageTags(pageId, tags);
       result.tags = await PageTagRelation.listTagNamesByPage(pageId);
-      // TODO :
-      // 1. find pageTagRelation based on 'tags'
-      // 2. set its updatedAt to result.updatedAt
-      // result.updatedAt = ...
       tagEvent.emit('update', page, tags);
     }
     catch (err) {