mirror of
https://github.com/wekan/wekan.git
synced 2026-03-02 03:40:16 +01:00
Prettier & eslint project style update
This commit is contained in:
parent
a0a482aa8e
commit
3eb4d2c341
116 changed files with 6216 additions and 5240 deletions
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue