-
Notifications
You must be signed in to change notification settings - Fork 15
Copilot workflow changes #89
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,6 +101,34 @@ const getNotificationsForMentionedUser = (eventConfig, content) => { | |
}); | ||
}; | ||
|
||
/** | ||
* Get notifications for users obtained from originator | ||
* | ||
* @param {Object} eventConfig event configuration | ||
* @param {String} originator originator userId | ||
* | ||
* @return {Promise} resolves to a list of notifications | ||
*/ | ||
const getNotificationsForOriginator = (eventConfig, originator) => { | ||
// if event doesn't have to be notified to creator, just ignore | ||
if (!eventConfig.creator) { | ||
return Promise.resolve([]); | ||
} | ||
|
||
// if we have to send notification to the creator, | ||
// but it's not provided in the message, then throw error | ||
if (!originator) { | ||
return Promise.reject(new Error('Missing originator in the event message.')); | ||
} | ||
|
||
return Promise.resolve([{ | ||
userId: originator.toString(), | ||
contents: { | ||
originator: true, | ||
}, | ||
}]); | ||
}; | ||
|
||
/** | ||
* Get project members notifications | ||
* | ||
|
@@ -307,6 +335,7 @@ const handler = (topic, message, logger, callback) => { | |
// - check that event has everything required or throw error | ||
getNotificationsForTopicStarter(eventConfig, message.topicId), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @gondzo we might reuse the logic of |
||
getNotificationsForUserId(eventConfig, message.userId), | ||
getNotificationsForOriginator(eventConfig, message.originator), | ||
getNotificationsForMentionedUser(eventConfig, message.postContent), | ||
getProjectMembersNotifications(eventConfig, project), | ||
getTopCoderMembersNotifications(eventConfig), | ||
|
@@ -321,7 +350,7 @@ const handler = (topic, message, logger, callback) => { | |
)).then((notifications) => { | ||
allNotifications = _.filter(notifications, notification => notification.userId !== `${message.initiatorUserId}`); | ||
|
||
if (eventConfig.includeUsers && message[eventConfig.includeUsers] && message[eventConfig.includeUsers].length>0){ | ||
if (eventConfig.includeUsers && message[eventConfig.includeUsers] && message[eventConfig.includeUsers].length > 0) { | ||
allNotifications = _.filter(allNotifications, notification => message[eventConfig.includeUsers].contains(notification.userId)); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ | |
<td class="main-td"> | ||
<table class="main-child"> | ||
<tr><td></td></tr> | ||
</table> | ||
</table> | ||
</td> | ||
</tr> | ||
|
||
|
@@ -60,12 +60,25 @@ | |
{{#if [notifications.connect.project.member.invite.created]}} | ||
Hi <strong>{{userFullName}}</strong>, you are invited to join the project {{projectName}}. Please click on the button ("View project on Connect") below to join. | ||
{{/if}} | ||
{{#if [notifications.connect.project.member.invite.requested]}} | ||
You are requested to add <strong>{{userFullName}}</strong> as a copilot | ||
{{/if}} | ||
{{#if [notifications.connect.project.member.invite.approved]}} | ||
{{#if [creator]}} | ||
|
||
Your request to add invite the member was approved | ||
{{else}} | ||
Hi <strong>{{userFullName}}</strong>, you are added as a copilot | ||
{{/if}} | ||
{{/if}} | ||
{{#if [notifications.connect.project.member.invite.rejected]}} | ||
Your request to add the member was refused | ||
{{/if}} | ||
</td> | ||
</tr> | ||
</table> | ||
</td> | ||
</tr> | ||
</table> | ||
</table> | ||
</td> | ||
</tr> | ||
{{/each}} | ||
|
@@ -76,7 +89,7 @@ | |
<td class="main-td"> | ||
<table class="main-child"> | ||
<tr><td></td></tr> | ||
</table> | ||
</table> | ||
</td> | ||
</tr> | ||
<tr class="button-row button-one"> | ||
|
@@ -98,7 +111,7 @@ | |
<td class="main-td"> | ||
<table class="main-child"> | ||
<tr><td></td></tr> | ||
</table> | ||
</table> | ||
</td> | ||
</tr> | ||
{{/if}} | ||
{{/if}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gondzo I forgot how do we manage these ids when we test the application in dev env?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We just use what is set in the admin app - role ids should be consistent between dev and prod