Skip to content
Snippets Groups Projects
Commit 37ec6d26 authored by Sebastian Mihalache's avatar Sebastian Mihalache
Browse files

Merge branch 'develop' of gitlab.coko.foundation:xpub/xpub-faraday into develop

parents fb0f44af b74266f2
No related branches found
No related tags found
1 merge request!13Sprint #14
......@@ -50,7 +50,6 @@ function unauthenticatedUser(operation, object) {
return false
}
const publicStatusesPermissions = ['author', 'reviewer']
const createPaths = ['/collections', '/collections/:collectionId/fragments']
async function authenticatedUser(user, operation, object, context) {
......@@ -90,23 +89,6 @@ async function authenticatedUser(user, operation, object, context) {
}
if (get(object, 'type') === 'collection') {
if (helpers.isOwner({ user, object })) {
if (
await helpers.hasFragmentInDraft({
object,
Fragment: context.models.Fragment,
})
) {
return {
filter: collection => ({
...collection,
status: 'draft',
visibleStatus: statuses.draft.public,
}),
}
}
return true
}
return {
filter: async collection => {
const status = get(collection, 'status') || 'draft'
......@@ -115,20 +97,17 @@ async function authenticatedUser(user, operation, object, context) {
Team: context.models.Team,
})
const collectionPermission = userPermissions.find(
const { role } = userPermissions.find(
p =>
p.objectId === collection.id ||
collection.fragments.includes(p.objectId),
)
if (
publicStatusesPermissions.includes(
get(collectionPermission, 'role'),
)
) {
collection.visibleStatus = statuses[status].public
}
const visibleStatus = get(statuses, `${status}.${role}.label`)
return collection
return {
...collection,
visibleStatus,
}
},
}
}
......
......@@ -91,48 +91,313 @@ module.exports = {
],
statuses: {
draft: {
public: 'Draft',
private: 'Draft',
importance: 1,
author: {
label: 'Complete Submission',
needsAttention: true,
},
admin: {
label: 'Complete Submission',
needsAttention: true,
},
},
technicalChecks: {
importance: 2,
author: {
label: 'Submitted',
needsAttention: false,
},
editorInChief: {
label: 'QA',
needsAttention: false,
},
admin: {
label: 'Approve QA',
needsAttention: true,
},
},
submitted: {
public: 'Submitted',
private: 'Submitted',
importance: 3,
author: {
label: 'Submitted',
needsAttention: false,
},
editorInChief: {
label: 'Assign HE',
needsAttention: true,
},
admin: {
label: 'Assign HE',
needsAttention: true,
},
},
heInvited: {
public: 'Submitted',
private: 'Handling Editor Invited',
importance: 4,
author: {
label: 'HE Invited',
needsAttention: false,
},
handlingEditor: {
label: 'Respond to Invite',
needsAttention: true,
},
editorInChief: {
label: 'HE Invited',
needsAttention: false,
},
admin: {
label: 'Respond to Invite',
needsAttention: true,
},
},
heAssigned: {
public: 'Handling Editor Assigned',
private: 'Handling Editor Assigned',
importance: 5,
author: {
label: 'HE Assigned',
needsAttention: false,
},
handlingEditor: {
label: 'Invite Reviewers',
needsAttention: true,
},
editorInChief: {
label: 'HE Assigned',
needsAttention: false,
},
admin: {
label: 'Invite Reviewers',
needsAttention: true,
},
},
reviewersInvited: {
public: 'Reviewers Invited',
private: 'Reviewers Invited',
importance: 6,
author: {
label: 'Reviewers Invited',
needsAttention: false,
},
handlingEditor: {
label: 'Check Review Process',
needsAttention: true,
},
editorInChief: {
label: 'Reviewers Invited',
needsAttention: false,
},
reviewer: {
label: 'Respond to Invite',
needsAttention: true,
},
admin: {
label: 'Respond to Invite',
needsAttention: true,
},
},
underReview: {
public: 'Under Review',
private: 'Under Review',
importance: 7,
author: {
label: 'Under Review',
needsAttention: false,
},
handlingEditor: {
label: 'Check Review Process',
needsAttention: true,
},
editorInChief: {
label: 'Under Review',
needsAttention: false,
},
reviewer: {
label: 'Complete Review',
needsAttention: true,
},
admin: {
label: 'Complete Review',
needsAttention: true,
},
},
reviewCompleted: {
public: 'Under Review',
private: 'Review Completed',
},
pendingApproval: {
public: 'Under Review',
private: 'Pending Approval',
importance: 8,
author: {
label: 'Review Completed',
needsAttention: false,
},
handlingEditor: {
label: 'Make Decision',
needsAttention: true,
},
editorInChief: {
label: 'Review Completed',
needsAttention: false,
},
reviewer: {
label: 'Review Completed',
needsAttention: false,
},
admin: {
label: 'Make Decision',
needsAttention: true,
},
},
revisionRequested: {
public: 'Revision Requested',
private: 'Revision Requested',
importance: 9,
author: {
label: 'Submit Revision',
needsAttention: true,
},
handlingEditor: {
label: 'Revision Requested',
needsAttention: false,
},
editorInChief: {
label: 'Revision Requested',
needsAttention: false,
},
reviewer: {
label: 'Revision Requested',
needsAttention: false,
},
admin: {
label: 'Submit Revision',
needsAttention: true,
},
},
pendingApproval: {
importance: 10,
author: {
label: 'Pending Approval',
needsAttention: false,
},
handlingEditor: {
label: 'Pending Approval',
needsAttention: false,
},
editorInChief: {
label: 'Make Decision',
needsAttention: true,
},
reviewer: {
label: 'Pending Approval',
needsAttention: false,
},
admin: {
label: 'Make Decision',
needsAttention: true,
},
},
rejected: {
public: 'Rejected',
private: 'Rejected',
importance: 11,
author: {
label: 'Rejected',
needsAttention: false,
},
handlingEditor: {
label: 'Rejected',
needsAttention: false,
},
editorInChief: {
label: 'Rejected',
needsAttention: false,
},
reviewer: {
label: 'Rejected',
needsAttention: false,
},
admin: {
label: 'Rejected',
needsAttention: false,
},
},
inQA: {
importance: 12,
author: {
label: 'Pending approval',
needsAttention: false,
},
handlingEditor: {
label: 'QA',
needsAttention: false,
},
editorInChief: {
label: 'QA',
needsAttention: false,
},
reviewer: {
label: 'QA',
needsAttention: false,
},
admin: {
label: 'Approve QA',
needsAttention: true,
},
},
accepted: {
importance: 13,
author: {
label: 'Accepted',
needsAttention: false,
},
handlingEditor: {
label: 'Accepted',
needsAttention: false,
},
editorInChief: {
label: 'Accepted',
needsAttention: false,
},
reviewer: {
label: 'Accepted',
needsAttention: false,
},
admin: {
label: 'Accepted',
needsAttention: false,
},
},
withdrawalRequested: {
importance: 14,
author: {
label: 'Withdrawal Requested',
needsAttention: false,
},
handlingEditor: {
label: 'Withdrawal Requested',
needsAttention: false,
},
editorInChief: {
label: 'Approve Withdrawal',
needsAttention: true,
},
reviewer: {
label: 'Withdrawal Requested',
needsAttention: false,
},
admin: {
label: 'Approve Withdrawal',
needsAttention: true,
},
},
published: {
public: 'Published',
private: 'Published',
withdrawn: {
importance: 15,
author: {
label: 'Withdrawn',
needsAttention: false,
},
handlingEditor: {
label: 'Withdrawn',
needsAttention: false,
},
editorInChief: {
label: 'Withdrawn',
needsAttention: false,
},
reviewer: {
label: 'Withdrawn',
needsAttention: false,
},
admin: {
label: 'Withdrawn',
needsAttention: false,
},
},
},
'manuscript-types': {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment