Skip to content

Commit 4f2ea1a

Browse files
committed
fix: don't show applied on for completed project
1 parent d10aa02 commit 4f2ea1a

File tree

2 files changed

+1
-47
lines changed

2 files changed

+1
-47
lines changed

src/routes/copilotOpportunity/assign.js

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import _ from 'lodash';
22
import validate from 'express-validation';
33
import Joi from 'joi';
4-
import config from 'config';
54

65
import models from '../../models';
76
import util from '../../util';
87
import { PERMISSION } from '../../permissions/constants';
9-
import { createEvent } from '../../services/busApi';
10-
import { CONNECT_NOTIFICATION_EVENT, COPILOT_APPLICATION_STATUS, COPILOT_OPPORTUNITY_STATUS, COPILOT_REQUEST_STATUS, EVENT, INVITE_STATUS, PROJECT_MEMBER_ROLE, RESOURCES } from '../../constants';
8+
import { COPILOT_APPLICATION_STATUS, COPILOT_OPPORTUNITY_STATUS, COPILOT_REQUEST_STATUS, EVENT, INVITE_STATUS, PROJECT_MEMBER_ROLE, RESOURCES } from '../../constants';
119

1210
const assignCopilotOpportunityValidations = {
1311
body: Joi.object().keys({
@@ -75,13 +73,6 @@ module.exports = [
7573
throw err;
7674
}
7775

78-
const project = await models.Project.findOne({
79-
where: {
80-
id: projectId,
81-
},
82-
transaction: t,
83-
});
84-
8576
const existingInvite = await models.ProjectMemberInvite.findAll({
8677
where: {
8778
userId,
@@ -98,8 +89,6 @@ module.exports = [
9889
throw err;
9990
}
10091

101-
const applicationUser = await util.getMemberDetailsByUserIds([userId], req.log, req.id);
102-
10392
const invite = await models.ProjectMemberInvite.create({
10493
status: INVITE_STATUS.PENDING,
10594
role: PROJECT_MEMBER_ROLE.COPILOT,
@@ -114,46 +103,12 @@ module.exports = [
114103
transaction: t,
115104
})
116105

117-
console.log(invite.toJSON(), 'invite askjdhasd')
118-
119106
util.sendResourceToKafkaBus(
120107
req,
121108
EVENT.ROUTING_KEY.PROJECT_MEMBER_INVITE_CREATED,
122109
RESOURCES.PROJECT_MEMBER_INVITE,
123110
invite.toJSON());
124111

125-
const authUserDetails = await util.getMemberDetailsByUserIds([req.authUser.userId], req.log, req.id);
126-
127-
const emailEventType = CONNECT_NOTIFICATION_EVENT.PROJECT_MEMBER_EMAIL_INVITE_CREATED;
128-
await createEvent(emailEventType, {
129-
data: {
130-
workManagerUrl: config.get('workManagerUrl'),
131-
accountsAppURL: config.get('accountsAppUrl'),
132-
subject: config.get('inviteEmailSubject'),
133-
projects: [{
134-
name: project.name,
135-
projectId,
136-
sections: [
137-
{
138-
EMAIL_INVITES: true,
139-
title: config.get('inviteEmailSectionTitle'),
140-
projectName: project.name,
141-
projectId,
142-
initiator: authUserDetails[0],
143-
isSSO: util.isSSO(project),
144-
},
145-
],
146-
}],
147-
},
148-
recipients: [applicationUser[0].email],
149-
version: 'v3',
150-
from: {
151-
name: config.get('EMAIL_INVITE_FROM_NAME'),
152-
email: config.get('EMAIL_INVITE_FROM_EMAIL'),
153-
},
154-
categories: [`${process.env.NODE_ENV}:${emailEventType}`.toLowerCase()],
155-
}, req.log);
156-
157112
await application.update({
158113
status: COPILOT_APPLICATION_STATUS.INVITED,
159114
}, {

src/routes/projectMemberInvites/create.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,6 @@ module.exports = [
406406
req, invite.emails, inviteUserIds, invites, data, failed, members, inviteUsers))
407407
.then((values) => {
408408
values.forEach((v) => {
409-
console.log(v.toJSON(), 'v checking')
410409
// emit the event
411410
util.sendResourceToKafkaBus(
412411
req,

0 commit comments

Comments
 (0)