Skip to content

Commit b3c4746

Browse files
authored
Merge pull request #15 from maxceem/issue-9
Issue #9 - Notifications from CoderBot are not created correctly
2 parents e60ab0a + f326ad1 commit b3c4746

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

connect/connectNotificationServer.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,21 @@ const getNotificationsForTopicStarter = (eventConfig, topicId) => {
153153
return Promise.reject(new Error('Missing topicId in the event message.'));
154154
}
155155

156-
return service.getTopic(topicId).then((topic) => ({
157-
userId: topic.userId.toString(),
158-
contents: {
159-
toTopicStarter: true,
160-
},
161-
}));
156+
return service.getTopic(topicId).then((topic) => {
157+
const userId = topic.userId.toString();
158+
159+
// special case: if topic created by CoderBot, don't send notification to him
160+
if (userId === 'CoderBot') {
161+
return [];
162+
}
163+
164+
return [{
165+
userId,
166+
contents: {
167+
toTopicStarter: true,
168+
},
169+
}];
170+
});
162171
};
163172

164173
/**

0 commit comments

Comments
 (0)