From a6d8d86341609cd94b34e2936201bf95d8e83dbe Mon Sep 17 00:00:00 2001 From: Andrei Cioromila <andrei.cioromila@thinslices.com> Date: Wed, 10 Oct 2018 13:40:41 +0300 Subject: [PATCH] fix(authsome): Update collections status for /collections route --- packages/xpub-faraday/config/authsome-helpers.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/xpub-faraday/config/authsome-helpers.js b/packages/xpub-faraday/config/authsome-helpers.js index 2960282ae..f44cf2249 100644 --- a/packages/xpub-faraday/config/authsome-helpers.js +++ b/packages/xpub-faraday/config/authsome-helpers.js @@ -239,7 +239,19 @@ const getCollections = async ({ user, models }) => { role: up.role, }) - return stripedColl.coll + const role = get(up, 'role', 'author') + + let visibleStatus = get(statuses, `${status}.${role}.label`) + + if (role === 'reviewer' && status !== 'reviewersInvited') { + visibleStatus = await updateReviewerVisibleStatusByInvitation({ + collection, + FragmentModel: models.Fragment, + user, + }) + } + + return { ...stripedColl.coll, visibleStatus } }), )).filter(Boolean) } -- GitLab