From 89485c3dcd0a628ad0a6b36921196d710ac13a1f Mon Sep 17 00:00:00 2001 From: Tibet Sprague Date: Tue, 14 Nov 2023 13:22:07 -0800 Subject: [PATCH] Fix bug when editing events --- api/models/post/updatePost.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/api/models/post/updatePost.js b/api/models/post/updatePost.js index c93c48870..323fb761d 100644 --- a/api/models/post/updatePost.js +++ b/api/models/post/updatePost.js @@ -39,14 +39,15 @@ export function afterUpdatingPost (post, opts) { transacting } = opts + console.log("post type", post.get('type'), post) return post.ensureLoad(['groups']) - .then(() => Promise.all([ - updateChildren(post, requests, transacting), - updateGroups(post, group_ids, transacting), - updateAllMedia(post, params, transacting), - Tag.updateForPost(post, topicNames, userId, transacting), - updateFollowers(post, transacting) - ])) - .then(() => memberIds && post.setProjectMembers(memberIds, {transacting})) - .then(() => eventInviteeIds && post.updateEventInvitees(eventInviteeIds, userId, {transacting})) + .then(() => Promise.all([ + updateChildren(post, requests, transacting), + updateGroups(post, group_ids, transacting), + updateAllMedia(post, params, transacting), + Tag.updateForPost(post, topicNames, userId, transacting), + updateFollowers(post, transacting) + ])) + .then(() => post.get('type') === 'project' && memberIds && post.setProjectMembers(memberIds, { transacting })) + .then(() => post.get('type') === 'event' && eventInviteeIds && post.updateEventInvitees(eventInviteeIds, userId, { transacting })) }