Skip to content

Commit f181533

Browse files
authored
Merge branch 'develop' into pm-1168
2 parents 2fd1652 + c36ca64 commit f181533

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

src/permissions/copilotApplications.view.js

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,18 @@ module.exports = freq => new Promise((resolve, reject) => {
2121
const req = freq;
2222
req.context = req.context || {};
2323
req.context.currentOpportunity = opportunity;
24-
const projectId = opportunity.projectId;
2524
const isProjectManager = util.hasProjectManagerRole(req);
2625

27-
return models.ProjectMember.getActiveProjectMembers(projectId)
28-
.then(members => models.CopilotApplication.findOne({
29-
where: {
30-
opportunityId,
31-
userId: currentUserId,
32-
},
33-
}).then((copilotApplication) => {
34-
const isPartOfProject = isProjectManager && members.find(member => member.userId === currentUserId);
35-
// check if auth user has access to this project
36-
const hasAccess = util.hasAdminRole(req) || isPartOfProject || !!copilotApplication;
37-
return Promise.resolve(hasAccess);
38-
}));
26+
return models.CopilotApplication.findOne({
27+
where: {
28+
opportunityId: opportunityId,
29+
userId: currentUserId,
30+
},
31+
}).then((copilotApplication) => {
32+
// check if auth user has access to this project
33+
const hasAccess = util.hasAdminRole(req) || isProjectManager || !!copilotApplication;
34+
return Promise.resolve(hasAccess);
35+
})
3936
})
4037
.then((hasAccess) => {
4138
if (!hasAccess) {

src/routes/copilotOpportunityApply/create.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { COPILOT_OPPORTUNITY_STATUS } from '../../constants';
99

1010
const applyCopilotRequestValidations = {
1111
body: Joi.object().keys({
12-
notes: Joi.string(),
12+
notes: Joi.string().optional(),
1313
}),
1414
};
1515

0 commit comments

Comments
 (0)