summaryrefslogtreecommitdiffstats
path: root/server/notifications
diff options
context:
space:
mode:
authorJustin Reynolds <justinr1234@gmail.com>2019-06-28 12:52:09 -0500
committerJustin Reynolds <justinr1234@gmail.com>2019-06-28 12:56:51 -0500
commit3eb4d2c341b712268bd321173909e0a7b19a88c9 (patch)
tree25a8fcb088f3984e72a5bd3ded9e6a45376e0693 /server/notifications
parenta0a482aa8efb3255a523de4524c8e09453d5571f (diff)
downloadwekan-3eb4d2c341b712268bd321173909e0a7b19a88c9.tar.gz
wekan-3eb4d2c341b712268bd321173909e0a7b19a88c9.tar.bz2
wekan-3eb4d2c341b712268bd321173909e0a7b19a88c9.zip
Prettier & eslint project style update
Diffstat (limited to 'server/notifications')
-rw-r--r--server/notifications/email.js10
-rw-r--r--server/notifications/notifications.js11
-rw-r--r--server/notifications/outgoing.js39
-rw-r--r--server/notifications/watch.js5
4 files changed, 46 insertions, 19 deletions
diff --git a/server/notifications/email.js b/server/notifications/email.js
index 857c5d70..bb8a2687 100644
--- a/server/notifications/email.js
+++ b/server/notifications/email.js
@@ -3,11 +3,15 @@ Meteor.startup(() => {
Notifications.subscribe('email', (user, title, description, params) => {
// add quote to make titles easier to read in email text
const quoteParams = _.clone(params);
- ['card', 'list', 'oldList', 'board', 'comment'].forEach((key) => {
+ ['card', 'list', 'oldList', 'board', 'comment'].forEach(key => {
if (quoteParams[key]) quoteParams[key] = `"${params[key]}"`;
});
- const text = `${params.user} ${TAPi18n.__(description, quoteParams, user.getLanguage())}\n${params.url}`;
+ const text = `${params.user} ${TAPi18n.__(
+ description,
+ quoteParams,
+ user.getLanguage(),
+ )}\n${params.url}`;
user.addEmailBuffer(text);
// unlike setTimeout(func, delay, args),
@@ -39,5 +43,3 @@ Meteor.startup(() => {
}, process.env.EMAIL_NOTIFICATION_TIMEOUT || 30000);
});
});
-
-
diff --git a/server/notifications/notifications.js b/server/notifications/notifications.js
index fa8b2ee2..3f103339 100644
--- a/server/notifications/notifications.js
+++ b/server/notifications/notifications.js
@@ -14,14 +14,14 @@ Notifications = {
notifyServices[serviceName] = callback;
},
- unsubscribe: (serviceName) => {
+ unsubscribe: serviceName => {
if (typeof notifyServices[serviceName] === 'function')
delete notifyServices[serviceName];
},
- getUsers: (watchers) => {
+ getUsers: watchers => {
const users = [];
- watchers.forEach((userId) => {
+ watchers.forEach(userId => {
const user = Users.findOne(userId);
if (user) users.push(user);
});
@@ -29,9 +29,10 @@ Notifications = {
},
notify: (user, title, description, params) => {
- for(const k in notifyServices) {
+ for (const k in notifyServices) {
const notifyImpl = notifyServices[k];
- if (notifyImpl && typeof notifyImpl === 'function') notifyImpl(user, title, description, params);
+ if (notifyImpl && typeof notifyImpl === 'function')
+ notifyImpl(user, title, description, params);
}
},
};
diff --git a/server/notifications/outgoing.js b/server/notifications/outgoing.js
index 655fe824..85d54968 100644
--- a/server/notifications/outgoing.js
+++ b/server/notifications/outgoing.js
@@ -8,7 +8,18 @@ const postCatchError = Meteor.wrapAsync((url, options, resolve) => {
});
});
-const webhooksAtbts = ( (process.env.WEBHOOKS_ATTRIBUTES && process.env.WEBHOOKS_ATTRIBUTES.split(',') ) || ['cardId', 'listId', 'oldListId', 'boardId', 'comment', 'user', 'card', 'commentId', 'swimlaneId']);
+const webhooksAtbts = (process.env.WEBHOOKS_ATTRIBUTES &&
+ process.env.WEBHOOKS_ATTRIBUTES.split(',')) || [
+ 'cardId',
+ 'listId',
+ 'oldListId',
+ 'boardId',
+ 'comment',
+ 'user',
+ 'card',
+ 'commentId',
+ 'swimlaneId',
+];
Meteor.methods({
outgoingWebhooks(integrations, description, params) {
@@ -18,13 +29,29 @@ Meteor.methods({
// label activity did not work yet, see wekan/models/activities.js
const quoteParams = _.clone(params);
- ['card', 'list', 'oldList', 'board', 'oldBoard', 'comment', 'checklist', 'swimlane', 'oldSwimlane', 'label', 'attachment'].forEach((key) => {
+ [
+ 'card',
+ 'list',
+ 'oldList',
+ 'board',
+ 'oldBoard',
+ 'comment',
+ 'checklist',
+ 'swimlane',
+ 'oldSwimlane',
+ 'label',
+ 'attachment',
+ ].forEach(key => {
if (quoteParams[key]) quoteParams[key] = `"${params[key]}"`;
});
- const userId = (params.userId) ? params.userId : integrations[0].userId;
+ const userId = params.userId ? params.userId : integrations[0].userId;
const user = Users.findOne(userId);
- const text = `${params.user} ${TAPi18n.__(description, quoteParams, user.getLanguage())}\n${params.url}`;
+ const text = `${params.user} ${TAPi18n.__(
+ description,
+ quoteParams,
+ user.getLanguage(),
+ )}\n${params.url}`;
if (text.length === 0) return;
@@ -32,7 +59,7 @@ Meteor.methods({
text: `${text}`,
};
- webhooksAtbts.forEach((key) => {
+ webhooksAtbts.forEach(key => {
if (params[key]) value[key] = params[key];
});
value.description = description;
@@ -45,7 +72,7 @@ Meteor.methods({
data: value,
};
- integrations.forEach((integration) => {
+ integrations.forEach(integration => {
const response = postCatchError(integration.url, options);
if (response && response.statusCode && response.statusCode === 200) {
diff --git a/server/notifications/watch.js b/server/notifications/watch.js
index 253e15ba..8a628dad 100644
--- a/server/notifications/watch.js
+++ b/server/notifications/watch.js
@@ -12,22 +12,19 @@ Meteor.methods({
watchableObj = Boards.findOne(id);
if (!watchableObj) throw new Meteor.Error('error-board-doesNotExist');
board = watchableObj;
-
} else if (watchableType === 'list') {
watchableObj = Lists.findOne(id);
if (!watchableObj) throw new Meteor.Error('error-list-doesNotExist');
board = watchableObj.board();
-
} else if (watchableType === 'card') {
watchableObj = Cards.findOne(id);
if (!watchableObj) throw new Meteor.Error('error-card-doesNotExist');
board = watchableObj.board();
-
} else {
throw new Meteor.Error('error-json-schema');
}
- if ((board.permission === 'private') && !board.hasMember(userId))
+ if (board.permission === 'private' && !board.hasMember(userId))
throw new Meteor.Error('error-board-notAMember');
watchableObj.setWatcher(userId, level);