yohei0125 4 лет назад
Родитель
Сommit
d2ff23553a

+ 6 - 3
packages/app/src/components/IdenticalPathPage.tsx

@@ -18,17 +18,20 @@ const IdenticalPathPage:FC<IdenticalPathPageProps> = (props:IdenticalPathPagePro
 
   return (
     <div className="container">
+      {/* Todo: show alert */}
+
+      {/* identical page list */}
       <ul className="list-group">
-        {/* Todo: show alert */}
         {pageDataList.map((data) => {
           return (
             <PageListItem
               key={data.pageData._id}
-              page={data} // need this to have valid userpicture
+              page={data}
               isSelected={false}
               isChecked={false}
-              isEnableActions={false}
+              isEnableActions
               shortBody={shortbodyMap[data.pageData._id]}
+              // Todo: add onClickDeleteButton when delete feature implemented
             />
           );
         })}

+ 1 - 0
packages/app/src/components/Page/PageListItem.tsx

@@ -118,6 +118,7 @@ const PageListItem: FC<Props> = memo((props:Props) => {
                   onClickDeleteButtonHandler={props.onClickDeleteButton}
                   isEnableActions={isEnableActions}
                   isDeletable={!isTopPage(pageData.path)}
+                  // Todo: add onClickRenameButtonHandler
                 />
               </div>
             </div>

+ 4 - 1
packages/app/src/server/models/page.ts

@@ -7,7 +7,7 @@ import mongoosePaginate from 'mongoose-paginate-v2';
 import uniqueValidator from 'mongoose-unique-validator';
 import nodePath from 'path';
 
-import { getOrCreateModel, pagePathUtils } from '@growi/core';
+import { getOrCreateModel, pagePathUtils, getModelSafely } from '@growi/core';
 import loggerFactory from '../../utils/logger';
 import Crowi from '../crowi';
 import { IPage } from '../../interfaces/page';
@@ -218,6 +218,9 @@ schema.statics.findByPathAndViewer = async function(
 
   const baseQuery = useFindOne ? this.findOne({ path }) : this.find({ path });
   const queryBuilder = new PageQueryBuilder(baseQuery, includeEmpty);
+
+  const User = getModelSafely('User') || require('~/server/models/user')();
+  queryBuilder.populateDataToList(User.USER_FIELDS_EXCEPT_CONFIDENTIAL);
   await addViewerCondition(queryBuilder, user, userGroups);
 
   return queryBuilder.query.exec();

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

@@ -619,6 +619,7 @@ module.exports = function(crowi, app) {
       const shortBodyMap = await crowi.pageService.shortBodiesMapByPageIds(pageIds);
       const identicalPageDataList = await Promise.all(pages.map(async(page) => {
         const bookmarkCount = await Bookmark.countByPageId(page._id);
+        page._doc.seenUserCount = (page.seenUsers && page.seenUsers.length) || 0;
         return {
           pageData: page,
           pageMeta: {