diff --git a/api-spanboon/package.json b/api-spanboon/package.json index 7a631c7d2..9ac315c77 100755 --- a/api-spanboon/package.json +++ b/api-spanboon/package.json @@ -79,6 +79,7 @@ "graphql": "15.4.0", "helmet": "^4.2.0", "imagemagick": "^0.1.3", + "jsdom": "^17.0.0", "jsonfile": "6.1.0", "jsonwebtoken": "^8.5.1", "lodash": "^4.17.21", diff --git a/api-spanboon/src/api/controllers/FulfillmentCaseController.ts b/api-spanboon/src/api/controllers/FulfillmentCaseController.ts index fd852f0b7..b2a1f6ff1 100644 --- a/api-spanboon/src/api/controllers/FulfillmentCaseController.ts +++ b/api-spanboon/src/api/controllers/FulfillmentCaseController.ts @@ -3072,7 +3072,7 @@ export class FulfillmentController { postPage.deleted = false; postPage.ownerUser = new ObjectID(userId); postPage.commentCount = 0; - postPage.repostCount = 0; + postPage.repostCount = 1; // set to 1 because we auto repost for user at the end of method. postPage.shareCount = 0; postPage.likeCount = 0; postPage.viewCount = 0; diff --git a/api-spanboon/src/api/controllers/PagePostController.ts b/api-spanboon/src/api/controllers/PagePostController.ts index 13d1c5fc2..86e19de9b 100644 --- a/api-spanboon/src/api/controllers/PagePostController.ts +++ b/api-spanboon/src/api/controllers/PagePostController.ts @@ -1269,9 +1269,9 @@ export class PagePostController { const pageId = posts.pageId; const referencePost = posts.referencePost; if (pageId !== null && pageId !== undefined && pageId !== '') { - postsMap[pageId + ':' + referencePost + ':' + uId] = posts; + postsMap[pageId + ':' + referencePost + ':' + posts.postAsPage] = posts; } else { - postsMap[referencePost + ':' + uId] = posts; + postsMap[referencePost + ':' + posts.ownerUser] = posts; } } } diff --git a/api-spanboon/src/api/processors/UserFollowSectionProcessor.ts b/api-spanboon/src/api/processors/UserFollowSectionProcessor.ts index 033385c8c..4fd4bcb2a 100644 --- a/api-spanboon/src/api/processors/UserFollowSectionProcessor.ts +++ b/api-spanboon/src/api/processors/UserFollowSectionProcessor.ts @@ -19,6 +19,7 @@ import { S3Service } from '../services/S3Service'; import { ObjectID } from 'mongodb'; import moment from 'moment'; import { PLATFORM_NAME_TH } from '../../constants/SystemConfig'; +import { POST_TYPE } from '../../constants/PostType'; export class UserFollowSectionProcessor extends AbstractSectionModelProcessor { @@ -131,6 +132,9 @@ export class UserFollowSectionProcessor extends AbstractSectionModelProcessor { lastestFilter.whereConditions.deleted = false; lastestFilter.whereConditions.hidden = false; lastestFilter.whereConditions.startDateTime = { $lte: today }; + lastestFilter.whereConditions.type= { + $nin: [POST_TYPE.FULFILLMENT] + }; // remove fulfillment post type comment this for showing all post type. // overide start datetime const dateTimeAndArray = []; diff --git a/api-spanboon/src/api/processors/UserRecommendSectionProcessor.ts b/api-spanboon/src/api/processors/UserRecommendSectionProcessor.ts index 35c19c514..52b62e617 100644 --- a/api-spanboon/src/api/processors/UserRecommendSectionProcessor.ts +++ b/api-spanboon/src/api/processors/UserRecommendSectionProcessor.ts @@ -16,6 +16,7 @@ import moment from 'moment'; import { PLATFORM_NAME_TH } from '../../constants/SystemConfig'; import { ObjectID } from 'mongodb'; import { S3Service } from '../services/S3Service'; +import { POST_TYPE } from '../../constants/PostType'; export class UserRecommendSectionProcessor extends AbstractSectionModelProcessor { @@ -90,8 +91,11 @@ export class UserRecommendSectionProcessor extends AbstractSectionModelProcessor const matchStmt: any = { isDraft: false, deleted: false, - hidden: false - }; + hidden: false, + type: { + $nin: [POST_TYPE.FULFILLMENT] // remove fulfillment post type comment this for showing all post type. + } + }; if (userId !== undefined && userId !== '') { // ! impl } else if (clientId !== undefined) {