Skip to content

tc-email-service release #70

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Mar 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"pg": "^4.5.5",
"pg-native": "^1.10.0",
"sequelize": "^3.23.0",
"tc-core-library-js": "appirio-tech/tc-core-library-js.git#v2.1",
"tc-core-library-js": "appirio-tech/tc-core-library-js.git#v2.2",
"traverse": "^0.6.6",
"urlencode": "^1.1.0"
},
Expand Down
33 changes: 17 additions & 16 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,25 +54,26 @@ export const EVENT = {
};

export const BUS_API_EVENT = {
PROJECT_CREATED: 'connect.project.created',
PROJECT_SUBMITTED_FOR_REVIEW: 'connect.project.submittedForReview',
PROJECT_APPROVED: 'connect.project.approved',
PROJECT_PAUSED: 'connect.project.paused',
PROJECT_COMPLETED: 'connect.project.completed',
PROJECT_CANCELED: 'connect.project.canceled',
PROJECT_CREATED: 'notifications.connect.project.created',
PROJECT_SUBMITTED_FOR_REVIEW: 'notifications.connect.project.submittedForReview',
PROJECT_APPROVED: 'notifications.connect.project.approved',
PROJECT_PAUSED: 'notifications.connect.project.paused',
PROJECT_COMPLETED: 'notifications.connect.project.completed',
PROJECT_CANCELED: 'notifications.connect.project.canceled',
PROJECT_ACTIVE: 'notifications.connect.project.active',

MEMBER_JOINED: 'connect.project.member.joined',
MEMBER_LEFT: 'connect.project.member.left',
MEMBER_REMOVED: 'connect.project.member.removed',
MEMBER_ASSIGNED_AS_OWNER: 'connect.project.member.assignedAsOwner',
MEMBER_JOINED_COPILOT: 'connect.project.member.copilotJoined',
MEMBER_JOINED_MANAGER: 'connect.project.member.managerJoined',
MEMBER_JOINED: 'notifications.connect.project.member.joined',
MEMBER_LEFT: 'notifications.connect.project.member.left',
MEMBER_REMOVED: 'notifications.connect.project.member.removed',
MEMBER_ASSIGNED_AS_OWNER: 'notifications.connect.project.member.assignedAsOwner',
MEMBER_JOINED_COPILOT: 'notifications.connect.project.member.copilotJoined',
MEMBER_JOINED_MANAGER: 'notifications.connect.project.member.managerJoined',

PROJECT_LINK_CREATED: 'connect.project.linkCreated',
PROJECT_FILE_UPLOADED: 'connect.project.fileUploaded',
PROJECT_SPECIFICATION_MODIFIED: 'connect.project.specificationModified',
PROJECT_LINK_CREATED: 'notifications.connect.project.linkCreated',
PROJECT_FILE_UPLOADED: 'notifications.connect.project.fileUploaded',
PROJECT_SPECIFICATION_MODIFIED: 'notifications.connect.project.specificationModified',
};

export const REGEX = {
URL: /^(http(s?):\/\/)?(www\.)?[a-zA-Z0-9\.\-\_]+(\.[a-zA-Z]{2,15})+(\:[0-9]{2,5})?(\/[a-zA-Z0-9\_\-\s\.\/\?\%\#\&\=]*)?$/, // eslint-disable-line
URL: /^(http(s?):\/\/)?(www\.)?[a-zA-Z0-9\.\-\_]+(\.[a-zA-Z]{2,15})+(\:[0-9]{2,5})?(\/[a-zA-Z0-9\_\-\s\.\/\?\%\#\&\=;]*)?$/, // eslint-disable-line

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gondzo I am not sure why it is showing this change in this PR as well while the change is already in master. I think it okay because at least it showing the correct changes being propagated again to master.

};
6 changes: 6 additions & 0 deletions src/events/busApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const mapEventTypes = {
[PROJECT_STATUS.COMPLETED]: BUS_API_EVENT.PROJECT_COMPLETED,
[PROJECT_STATUS.CANCELLED]: BUS_API_EVENT.PROJECT_CANCELED,
[PROJECT_STATUS.PAUSED]: BUS_API_EVENT.PROJECT_PAUSED,
[PROJECT_STATUS.ACTIVE]: BUS_API_EVENT.PROJECT_ACTIVE,
};

module.exports = (app, logger) => {
Expand All @@ -27,6 +28,7 @@ module.exports = (app, logger) => {
createEvent(BUS_API_EVENT.PROJECT_CREATED, {
projectId: project.id,
projectName: project.name,
userId: req.authUser.userId,
initiatorUserId: req.authUser.userId,
}, logger);
});
Expand All @@ -42,6 +44,7 @@ module.exports = (app, logger) => {
createEvent(mapEventTypes[updated.status], {
projectId: updated.id,
projectName: updated.name,
userId: req.authUser.userId,
initiatorUserId: req.authUser.userId,
}, logger);
} else if (
Expand All @@ -52,13 +55,15 @@ module.exports = (app, logger) => {
createEvent(BUS_API_EVENT.PROJECT_SPECIFICATION_MODIFIED, {
projectId: updated.id,
projectName: updated.name,
userId: req.authUser.userId,
initiatorUserId: req.authUser.userId,
}, logger);
} else if (!_.isEqual(original.bookmarks, updated.bookmarks)) {
logger.debug('project bookmarks is updated');
createEvent(BUS_API_EVENT.PROJECT_LINK_CREATED, {
projectId: updated.id,
projectName: updated.name,
userId: req.authUser.userId,
initiatorUserId: req.authUser.userId,
}, logger);
}
Expand Down Expand Up @@ -166,6 +171,7 @@ module.exports = (app, logger) => {
projectId,
projectName: project.name,
fileName: attachment.filePath.replace(/^.*[\\\/]/, ''), // eslint-disable-line
userId: req.authUser.userId,
initiatorUserId: req.authUser.userId,
}, logger);
}).catch(err => null); // eslint-disable-line no-unused-vars
Expand Down