Skip to content

Commit 7075d3f

Browse files
committed
fix: allow action to be empty string
1 parent 5025fa1 commit 7075d3f

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/routes/projectMembers/update.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ const completeAllCopilotRequests = async (req, projectId, _transaction, _member)
4444
const allCopilotRequests = await models.CopilotRequest.findAll({
4545
where: {
4646
projectId,
47+
status: {
48+
[Op.in]: [
49+
COPILOT_REQUEST_STATUS.APPROVED,
50+
COPILOT_REQUEST_STATUS.NEW,
51+
COPILOT_REQUEST_STATUS.SEEKING,
52+
],
53+
}
4754
},
4855
transaction: _transaction,
4956
});
@@ -127,8 +134,9 @@ const completeAllCopilotRequests = async (req, projectId, _transaction, _member)
127134
req.log.debug(`updated all copilot applications`);
128135

129136
const memberDetails = await util.getMemberDetailsByUserIds([_member.userId], req.log, req.id);
137+
const member = memberDetails[0];
130138

131-
req.log.debug(`member details: ${JSON.stringify(memberDetails)}`);
139+
req.log.debug(`member details: ${JSON.stringify(member)}`);
132140

133141
const emailEventType = CONNECT_NOTIFICATION_EVENT.EXTERNAL_ACTION_EMAIL;
134142
const copilotPortalUrl = config.get('copilotPortalUrl');
@@ -146,14 +154,14 @@ const completeAllCopilotRequests = async (req, projectId, _transaction, _member)
146154
opportunity_type: getCopilotTypeLabel(requestData.projectType),
147155
opportunity_title: requestData.opportunityTitle,
148156
start_date: moment.utc(requestData.startDate).format('DD-MM-YYYY'),
149-
user_name: memberDetails ? memberDetails.handle : "",
157+
user_name: member ? member.handle : "",
150158
},
151159
sendgrid_template_id: TEMPLATE_IDS.COPILOT_ALREADY_PART_OF_PROJECT,
152-
recipients: [memberDetails.email],
160+
recipients: [member.email],
153161
version: 'v3',
154162
}, req.log);
155163

156-
req.log.debug(`Sent email to ${memberDetails.email}`);
164+
req.log.debug(`Sent email to ${member.email}`);
157165
});
158166

159167
await _transaction.commit();

0 commit comments

Comments
 (0)