Skip to content

Commit 27ab024

Browse files
committed
fix default settings and tcwebserview userId
1 parent 1acbab9 commit 27ab024

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

connect/connectNotificationServer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ const handler = (topic, message, callback) => {
178178

179179
// filter out `notifications.connect.project.topic.created` events send by bot
180180
// because they create too much clutter and duplicate info
181-
if (topic === 'notifications.connect.project.topic.created' && message.userId === config.TCWEBSERVICE_ID) {
181+
if (topic === 'notifications.connect.project.topic.created' && message.userId.toString() === config.TCWEBSERVICE_ID) {
182182
return callback(null, []);
183183
}
184184

src/services/NotificationService.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,16 @@ function* updateSettings(data, userId) {
8787
*/
8888
function* listNotifications(query, userId) {
8989
const settings = yield getSettings(userId);
90-
// only filter out notifications types which were explicitly set to 'no' - so we return notification by default
91-
const notificationTypes = _.keys(settings).filter((notificationType) => settings[notificationType].web !== 'no');
90+
9291

9392
const filter = { where: {
9493
userId,
95-
type: { $in: notificationTypes },
9694
}, offset: query.offset, limit: query.limit, order: [['createdAt', 'DESC']] };
95+
if (_.keys(settings).length>0){
96+
// only filter out notifications types which were explicitly set to 'no' - so we return notification by default
97+
const notificationTypes = _.keys(settings).filter((notificationType) => settings[notificationType].web !== 'no');
98+
filter.where.type = { $in: notificationTypes };
99+
}
97100
if (query.type) {
98101
filter.where.type = query.type;
99102
}

0 commit comments

Comments
 (0)