From bcf48b76747cb32865ceff3038822cd5f39b46eb Mon Sep 17 00:00:00 2001
From: Jure Triglav <juretriglav@gmail.com>
Date: Thu, 13 Aug 2020 15:18:53 +0200
Subject: [PATCH] feat: use manuscriptId relation instead of polymorphism in
 dashboard

---
 .../component-dashboard/src/components/Dashboard.js    |  2 +-
 .../src/components/sections/EditorItem.js              |  2 +-
 .../src/components/sections/ReviewerItem.js            |  2 +-
 .../component-dashboard/src/graphql/mutations/index.js | 10 ++++------
 .../component-dashboard/src/graphql/queries/index.js   |  5 ++---
 5 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/app/components/component-dashboard/src/components/Dashboard.js b/app/components/component-dashboard/src/components/Dashboard.js
index 899780e5f5..ff23f5449e 100644
--- a/app/components/component-dashboard/src/components/Dashboard.js
+++ b/app/components/component-dashboard/src/components/Dashboard.js
@@ -41,7 +41,7 @@ const Dashboard = ({ history, ...props }) => {
   })
 
   if (loading) return <Spinner />
-  if (error) return error
+  if (error) return JSON.stringify(error)
   const dashboard = (data && data.manuscripts) || []
   const currentUser = data && data.currentUser
 
diff --git a/app/components/component-dashboard/src/components/sections/EditorItem.js b/app/components/component-dashboard/src/components/sections/EditorItem.js
index b6abd5d49a..35e1717511 100644
--- a/app/components/component-dashboard/src/components/sections/EditorItem.js
+++ b/app/components/component-dashboard/src/components/sections/EditorItem.js
@@ -28,7 +28,7 @@ const EditorItemLinks = ({ version }) => (
     <Action to={`/journal/versions/${version.id}/submit`}>Summary Info</Action>
     <Action
       data-testid="control-panel"
-      to={`/journal/versions/${version.id}/decisions/${version.id}`}
+      to={`/journal/versions/${version.id}/decision`}
     >
       {version.decision && version.decision.status === 'submitted'
         ? `Decision: ${version.decision.recommendation}`
diff --git a/app/components/component-dashboard/src/components/sections/ReviewerItem.js b/app/components/component-dashboard/src/components/sections/ReviewerItem.js
index 01a8fceafe..7856a9e98f 100644
--- a/app/components/component-dashboard/src/components/sections/ReviewerItem.js
+++ b/app/components/component-dashboard/src/components/sections/ReviewerItem.js
@@ -24,7 +24,7 @@ const ReviewerItem = ({ version, journals, currentUser, reviewerRespond }) => {
 
       {(status === 'accepted' || status === 'completed') && (
         <ActionGroup>
-          <Action to={`/journal/versions/${version.id}/reviews`}>
+          <Action to={`/journal/versions/${version.id}/review`}>
             {status === 'completed' ? 'Completed' : 'Do Review'}
           </Action>
         </ActionGroup>
diff --git a/app/components/component-dashboard/src/graphql/mutations/index.js b/app/components/component-dashboard/src/graphql/mutations/index.js
index 019eceb78b..cd9b489b44 100644
--- a/app/components/component-dashboard/src/graphql/mutations/index.js
+++ b/app/components/component-dashboard/src/graphql/mutations/index.js
@@ -16,9 +16,8 @@ export default {
         id
         role
         name
-        object {
-          objectId
-          objectType
+        manuscript {
+          id
         }
         members {
           id
@@ -50,9 +49,8 @@ export default {
           id
           role
           name
-          object {
-            objectId
-            objectType
+          manuscript {
+            id
           }
           members {
             id
diff --git a/app/components/component-dashboard/src/graphql/queries/index.js b/app/components/component-dashboard/src/graphql/queries/index.js
index 14952c20c8..e62bbe994f 100644
--- a/app/components/component-dashboard/src/graphql/queries/index.js
+++ b/app/components/component-dashboard/src/graphql/queries/index.js
@@ -28,9 +28,8 @@ export default {
           id
           role
           name
-          object {
-            objectId
-            objectType
+          manuscript {
+            id
           }
           members {
             id
-- 
GitLab