ソースを参照

Do not generate revision when tag is updated

Shun Miyazawa 3 年 前
コミット
8b7dd597e4

+ 2 - 4
packages/app/src/components/Navbar/GrowiContextualSubNavigation.tsx

@@ -210,9 +210,7 @@ const GrowiContextualSubNavigation = (props) => {
 
 
   const tagsUpdatedHandlerForViewMode = useCallback(async(newTags: string[]) => {
   const tagsUpdatedHandlerForViewMode = useCallback(async(newTags: string[]) => {
     try {
     try {
-      const res: IResTagsUpdateApiv1 = await apiPost('/tags.update', { pageId, revisionId, tags: newTags });
-      const updatedRevisionId = getIdForRef(res.savedPage.revision);
-      await pageContainer.setState({ revisionId: updatedRevisionId });
+      await apiPost('/tags.update', { pageId, revisionId, tags: newTags });
 
 
       // revalidate SWRTagsInfo
       // revalidate SWRTagsInfo
       mutateSWRTagsInfo();
       mutateSWRTagsInfo();
@@ -224,7 +222,7 @@ const GrowiContextualSubNavigation = (props) => {
       toastError(err, 'fail to update tags');
       toastError(err, 'fail to update tags');
     }
     }
 
 
-  }, [pageId, revisionId, mutateSWRTagsInfo, mutatePageTagsForEditors, pageContainer]);
+  }, [pageId, revisionId, mutateSWRTagsInfo, mutatePageTagsForEditors]);
 
 
   const tagsUpdatedHandlerForEditMode = useCallback((newTags: string[]): void => {
   const tagsUpdatedHandlerForEditMode = useCallback((newTags: string[]): void => {
     // It will not be reflected in the DB until the page is refreshed
     // It will not be reflected in the DB until the page is refreshed

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

@@ -158,8 +158,6 @@ module.exports = function(crowi, app) {
         return res.json(ApiResponse.error("You don't have permission to update this page."));
         return res.json(ApiResponse.error("You don't have permission to update this page."));
       }
       }
 
 
-      const previousRevision = await Revision.findById(revisionId);
-      result.savedPage = await Page.updatePage(page, previousRevision.body, previousRevision.body, req.user);
       await PageTagRelation.updatePageTags(pageId, tags);
       await PageTagRelation.updatePageTags(pageId, tags);
       result.tags = await PageTagRelation.listTagNamesByPage(pageId);
       result.tags = await PageTagRelation.listTagNamesByPage(pageId);