Compare commits
51
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ea1b3b7f92 | ||
|
|
4e2863faa7 | ||
|
|
b46fb43e6f | ||
|
|
bcacfa8fe2 | ||
|
|
4df2becd6f | ||
|
|
2990ea593a | ||
|
|
b976673826 | ||
|
|
16e034efcb | ||
|
|
6712625c3f | ||
|
|
b5bbf6a6a4 | ||
|
|
3d3e7761f5 | ||
|
|
fa56b9c01f | ||
|
|
882213784f | ||
|
|
251bd793f3 | ||
|
|
088b0e760b | ||
|
|
cc1fa1cc3b | ||
|
|
bcd3ea86e8 | ||
|
|
0176650f67 | ||
|
|
f3963aded3 | ||
|
|
bbe720481a | ||
|
|
04f9030474 | ||
|
|
6d135be859 | ||
|
|
63cbe7063e | ||
|
|
7985bea2b8 | ||
|
|
733abccaa9 | ||
|
|
119cce82b4 | ||
|
|
988e70ec40 | ||
|
|
5e3fca3771 | ||
|
|
6d9ce56f4a | ||
|
|
3c8c04fd37 | ||
|
|
790a1d5cc9 | ||
|
|
4b352fd878 | ||
|
|
a196f2ef11 | ||
|
|
6c65d135f7 | ||
|
|
a1a1e9a86a | ||
|
|
0d39a7567f | ||
|
|
76a18d06d6 | ||
|
|
ce52fc5af7 | ||
|
|
0a2863a79c | ||
|
|
39e320fe4b | ||
|
|
2f3dfe775e | ||
|
|
22964cb375 | ||
|
|
fd89cf7f2b | ||
|
|
273d994750 | ||
|
|
86d21d6abd | ||
|
|
a9c200cc3b | ||
|
|
3fedc14062 | ||
|
|
c42e1fb5dd | ||
|
|
9961340118 | ||
|
|
f54bd22757 | ||
|
|
1043dacd67 |
@@ -15,7 +15,7 @@ type: application
|
||||
# This is the chart version. This version number should be incremented each time you make changes
|
||||
# to the chart and its templates, including the app version.
|
||||
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
||||
version: 0.1.23
|
||||
version: 0.1.24
|
||||
|
||||
# This is the version number of the application being deployed. This version number should be
|
||||
# incremented each time you make changes to the application. Versions are not expected to
|
||||
|
||||
@@ -55,6 +55,11 @@ spec:
|
||||
- mountPath: /app/private/attachments
|
||||
subPath: attachments
|
||||
name: planka
|
||||
{{- if .Values.securityContext.readOnlyRootFilesystem }}
|
||||
- mountPath: /app/logs
|
||||
subPath: app-logs
|
||||
name: emptydir
|
||||
{{- end }}
|
||||
resources:
|
||||
{{- toYaml .Values.resources | nindent 12 }}
|
||||
env:
|
||||
@@ -139,3 +144,7 @@ spec:
|
||||
{{- else }}
|
||||
emptyDir: {}
|
||||
{{- end }}
|
||||
{{- if .Values.securityContext.readOnlyRootFilesystem }}
|
||||
- name: emptydir
|
||||
emptyDir: {}
|
||||
{{- end }}
|
||||
|
||||
@@ -47,9 +47,11 @@ initializeCore.fetchConfig = (config) => ({
|
||||
},
|
||||
});
|
||||
|
||||
const logout = () => ({
|
||||
const logout = (invalidateAccessToken) => ({
|
||||
type: ActionTypes.LOGOUT,
|
||||
payload: {},
|
||||
payload: {
|
||||
invalidateAccessToken,
|
||||
},
|
||||
});
|
||||
|
||||
logout.invalidateAccessToken = () => ({
|
||||
|
||||
@@ -38,7 +38,7 @@ const handleCardUpdate = (card) => ({
|
||||
},
|
||||
});
|
||||
|
||||
const moveCard = (id, listId, index = 0) => ({
|
||||
const moveCard = (id, listId, index) => ({
|
||||
type: EntryActionTypes.CARD_MOVE,
|
||||
payload: {
|
||||
id,
|
||||
@@ -47,7 +47,7 @@ const moveCard = (id, listId, index = 0) => ({
|
||||
},
|
||||
});
|
||||
|
||||
const moveCurrentCard = (listId, index = 0) => ({
|
||||
const moveCurrentCard = (listId, index) => ({
|
||||
type: EntryActionTypes.CURRENT_CARD_MOVE,
|
||||
payload: {
|
||||
listId,
|
||||
@@ -55,7 +55,7 @@ const moveCurrentCard = (listId, index = 0) => ({
|
||||
},
|
||||
});
|
||||
|
||||
const transferCard = (id, boardId, listId, index = 0) => ({
|
||||
const transferCard = (id, boardId, listId, index) => ({
|
||||
type: EntryActionTypes.CARD_TRANSFER,
|
||||
payload: {
|
||||
id,
|
||||
@@ -65,7 +65,7 @@ const transferCard = (id, boardId, listId, index = 0) => ({
|
||||
},
|
||||
});
|
||||
|
||||
const transferCurrentCard = (boardId, listId, index = 0) => ({
|
||||
const transferCurrentCard = (boardId, listId, index) => ({
|
||||
type: EntryActionTypes.CURRENT_CARD_TRANSFER,
|
||||
payload: {
|
||||
boardId,
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import EntryActionTypes from '../constants/EntryActionTypes';
|
||||
|
||||
const logout = () => ({
|
||||
const logout = (invalidateAccessToken) => ({
|
||||
type: EntryActionTypes.LOGOUT,
|
||||
payload: {},
|
||||
payload: {
|
||||
invalidateAccessToken,
|
||||
},
|
||||
});
|
||||
|
||||
export default {
|
||||
|
||||
@@ -39,9 +39,9 @@ export default {
|
||||
areYouSureYouWantToLeaveBoard: 'Opravdu chcete opustit tuto tabuli?',
|
||||
areYouSureYouWantToLeaveProject: 'Opravdu chcete opustit projekt?',
|
||||
areYouSureYouWantToRemoveThisManagerFromProject:
|
||||
'Are you sure you want to remove this manager from the project?',
|
||||
'Jste si jisti, že chcete tohoto správce z projektu odebrat?',
|
||||
areYouSureYouWantToRemoveThisMemberFromBoard:
|
||||
'Opravdu chcete odstranit tohoto člena z tabule?',
|
||||
'Jste si jisti, že chcete tohoto člena odebrat z tabule?',
|
||||
attachment: 'Příloha',
|
||||
attachments: 'Přílohy',
|
||||
authentication: 'Ověření',
|
||||
@@ -55,6 +55,7 @@ export default {
|
||||
cardNotFound_title: 'Karta nenalezena',
|
||||
cardOrActionAreDeleted: 'Karta nebo akce je smazána.',
|
||||
color: 'Barva',
|
||||
copy_inline: 'copy',
|
||||
createBoard_title: 'Vytvořit tabuli',
|
||||
createLabel_title: 'Vytvořit štítek',
|
||||
createNewOneOrSelectExistingOne: 'Vytvořit nový nebo vyberte<br />již existující.',
|
||||
@@ -130,7 +131,7 @@ export default {
|
||||
phone: 'Telefon',
|
||||
preferences: 'Volby',
|
||||
pressPasteShortcutToAddAttachmentFromClipboard:
|
||||
'Tip: dejte Ctrl-V (Cmd-V na Mac) pro vložení přílohy ze schránky.',
|
||||
'Tip: stisknutím Ctrl-V (Cmd-V na Mac) přidáte přílohu ze schránky.',
|
||||
project: 'Projekt',
|
||||
projectNotFound_title: 'Projekt nenalezen',
|
||||
removeManager_title: 'Odstranit vedoucího',
|
||||
@@ -199,6 +200,8 @@ export default {
|
||||
deleteTask: 'Smazat úkol',
|
||||
deleteTask_title: 'Smazat úkol',
|
||||
deleteUser: 'Smazat uživatele',
|
||||
duplicate: 'Duplikovat',
|
||||
duplicateCard_title: 'Duplikovat kartu',
|
||||
edit: 'Upravit',
|
||||
editDueDate_title: 'Upravit termín do',
|
||||
editDescription_title: 'Upravit popis',
|
||||
@@ -226,13 +229,13 @@ export default {
|
||||
removeMember: 'Odstranit člena',
|
||||
save: 'Uložit',
|
||||
showAllAttachments: 'Zozbrazit všechny přílohy ({{hidden}} skryté)',
|
||||
showFewerAttachments: 'Zobrazit méně příloh',
|
||||
showDetails: 'Zobrazit detaily',
|
||||
showFewerAttachments: 'Zobrazit méně příloh',
|
||||
start: 'Start',
|
||||
stop: 'Stop',
|
||||
subscribe: 'Odebírat',
|
||||
unsubscribe: 'Neodebírat',
|
||||
uploadNewAvatar: 'Nahrát nového avatara',
|
||||
uploadNewAvatar: 'Nahrát nový avatar',
|
||||
uploadNewImage: 'Nahrát nový obrázek',
|
||||
},
|
||||
},
|
||||
|
||||
@@ -3,10 +3,10 @@ export default {
|
||||
date: 'd/M/yyyy',
|
||||
time: 'p',
|
||||
dateTime: '$t(format:date) $t(format:time)',
|
||||
longDate: 'MMM d',
|
||||
longDateTime: "MMMM d 'at' p",
|
||||
fullDate: 'MMM d, y',
|
||||
fullDateTime: "MMMM d, y 'at' p",
|
||||
longDate: 'd MMM',
|
||||
longDateTime: "d MMMM 'alle' p",
|
||||
fullDate: 'd MMM, y',
|
||||
fullDateTime: "d MMMM, y 'alle' p",
|
||||
},
|
||||
|
||||
translation: {
|
||||
@@ -21,7 +21,7 @@ export default {
|
||||
administrator: 'Amministratore',
|
||||
all: 'tutto',
|
||||
allChangesWillBeAutomaticallySavedAfterConnectionRestored:
|
||||
'All changes will be automatically saved<br />after connection restored.',
|
||||
'Tutte le modifiche verranno salvate<br />al ripristino della connessione.',
|
||||
areYouSureYouWantToDeleteThisAttachment: 'Sei sicuro di voler eliminare questo allegato?',
|
||||
areYouSureYouWantToDeleteThisBoard: 'Sei sicuro di voler eliminare questa bacheca?',
|
||||
areYouSureYouWantToDeleteThisCard: 'Sei sicuro di voler eliminare questa card?',
|
||||
@@ -50,6 +50,7 @@ export default {
|
||||
cardNotFound_title: 'Card non trovata',
|
||||
cardOrActionAreDeleted: "La card o l'azione vengono eliminate.",
|
||||
color: 'Colore',
|
||||
copy_inline: 'copia',
|
||||
createBoard_title: 'Crea Bacheca',
|
||||
createLabel_title: 'Crea Etichetta',
|
||||
createNewOneOrSelectExistingOne: 'Crea nuovo o seleziona<br />esistente.',
|
||||
@@ -94,8 +95,10 @@ export default {
|
||||
filterByLabels_title: 'Filtra per Etichetta',
|
||||
filterByMembers_title: 'Filtra per Membro',
|
||||
fromComputer_title: 'Dal Computer',
|
||||
fromTrello: 'Da Trello',
|
||||
general: 'Generale',
|
||||
hours: 'Ore',
|
||||
importBoard_title: 'Importa Board',
|
||||
invalidCurrentPassword: 'Password corrente non valida',
|
||||
labels: 'Etichette',
|
||||
language: 'Lingua',
|
||||
@@ -123,7 +126,7 @@ export default {
|
||||
phone: 'Telefono',
|
||||
preferences: 'Preferenze',
|
||||
pressPasteShortcutToAddAttachmentFromClipboard:
|
||||
'Tip: prmi Ctrl-V (Cmd-V on Mac) per aggiungere un allegato dalla clipboard.',
|
||||
'Consiglio: premi Ctrl-V (Cmd-V on Mac) per aggiungere un allegato dalla clipboard.',
|
||||
project: 'Progetto',
|
||||
projectNotFound_title: 'Progetto non trovato',
|
||||
removeManager_title: 'Rimuovi Manager',
|
||||
@@ -193,6 +196,8 @@ export default {
|
||||
deleteTask: 'Elimina task',
|
||||
deleteTask_title: 'Elimina Task',
|
||||
deleteUser: 'Elimina utente',
|
||||
duplicate: 'Duplica',
|
||||
duplicateCard_title: 'Duplica Card',
|
||||
edit: 'Modifica',
|
||||
editDueDate_title: 'Modifica data di scadenza',
|
||||
editDescription_title: 'Modifica Descrizione',
|
||||
@@ -204,9 +209,10 @@ export default {
|
||||
editTitle_title: 'Modifica Titolo',
|
||||
editUsername_title: 'Modifica Username',
|
||||
hideDetails: 'Nascondi dettagli',
|
||||
import: 'Importa',
|
||||
leaveBoard: 'Lascia bacheca',
|
||||
leaveProject: 'Lascia progetto',
|
||||
logOut_title: 'Log Out',
|
||||
logOut_title: 'Disconnettiti',
|
||||
makeCover_title: 'Crea Cover',
|
||||
move: 'Muovi',
|
||||
moveCard_title: 'Muovi Card',
|
||||
|
||||
@@ -199,6 +199,8 @@ export default {
|
||||
deleteProject: 'Удалить проект',
|
||||
deleteTask: 'Удалить задачу',
|
||||
deleteUser: 'Удалить пользователя',
|
||||
duplicate: 'Дублировать',
|
||||
duplicateCard_title: 'Дублировать карточку',
|
||||
edit: 'Изменить',
|
||||
editBackground: 'Изменить фон',
|
||||
editDueDate: 'Изменить срок',
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { call, fork, join, put, select, take } from 'redux-saga/effects';
|
||||
|
||||
import selectors from '../../selectors';
|
||||
import actions from '../../actions';
|
||||
import { removeAccessToken } from '../../utils/access-token-storage';
|
||||
import entryActions from '../../entry-actions';
|
||||
import ErrorCodes from '../../constants/ErrorCodes';
|
||||
|
||||
let lastRequestTask;
|
||||
@@ -22,8 +21,7 @@ function* queueRequest(method, ...args) {
|
||||
});
|
||||
} catch (error) {
|
||||
if (error.code === ErrorCodes.UNAUTHORIZED) {
|
||||
yield call(removeAccessToken);
|
||||
yield put(actions.logout()); // TODO: next url
|
||||
yield put(entryActions.logout(false));
|
||||
yield take();
|
||||
}
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ export function* handleCardUpdate(card) {
|
||||
yield put(actions.handleCardUpdate(card));
|
||||
}
|
||||
|
||||
export function* moveCard(id, listId, index) {
|
||||
export function* moveCard(id, listId, index = 0) {
|
||||
const position = yield select(selectors.selectNextCardPosition, listId, index, id);
|
||||
|
||||
yield call(updateCard, id, {
|
||||
@@ -101,7 +101,7 @@ export function* moveCurrentCard(listId, index) {
|
||||
yield call(moveCard, cardId, listId, index);
|
||||
}
|
||||
|
||||
export function* transferCard(id, boardId, listId, index) {
|
||||
export function* transferCard(id, boardId, listId, index = 0) {
|
||||
const { cardId: currentCardId, boardId: currentBoardId } = yield select(selectors.selectPath);
|
||||
const position = yield select(selectors.selectNextCardPosition, listId, index, id);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { call, put, select, take } from 'redux-saga/effects';
|
||||
import { call, put, select } from 'redux-saga/effects';
|
||||
|
||||
import request from '../request';
|
||||
import requests from '../requests';
|
||||
@@ -84,8 +84,7 @@ export function* logout(invalidateAccessToken = true) {
|
||||
} catch (error) {} // eslint-disable-line no-empty
|
||||
}
|
||||
|
||||
yield put(actions.logout());
|
||||
yield take();
|
||||
yield put(actions.logout()); // TODO: next url
|
||||
}
|
||||
|
||||
export default {
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import { call, put, select, take } from 'redux-saga/effects';
|
||||
import { push } from '../../../lib/redux-router';
|
||||
|
||||
import { logout } from './core';
|
||||
import request from '../request';
|
||||
import selectors from '../../../selectors';
|
||||
import actions from '../../../actions';
|
||||
import api from '../../../api';
|
||||
import { getAccessToken } from '../../../utils/access-token-storage';
|
||||
import ActionTypes from '../../../constants/ActionTypes';
|
||||
import Paths from '../../../constants/Paths';
|
||||
|
||||
@@ -25,6 +27,13 @@ export function* goToCard(cardId) {
|
||||
}
|
||||
|
||||
export function* handleLocationChange() {
|
||||
const accessToken = yield call(getAccessToken);
|
||||
|
||||
if (!accessToken) {
|
||||
yield call(logout, false);
|
||||
return;
|
||||
}
|
||||
|
||||
const pathsMatch = yield select(selectors.selectPathsMatch);
|
||||
|
||||
if (!pathsMatch) {
|
||||
|
||||
@@ -218,6 +218,7 @@ export function* handleUserDelete(user) {
|
||||
|
||||
if (user.id === currentUserId) {
|
||||
yield call(logout, false);
|
||||
return;
|
||||
}
|
||||
|
||||
yield put(actions.handleUserDelete(user));
|
||||
|
||||
@@ -4,5 +4,9 @@ import services from '../services';
|
||||
import EntryActionTypes from '../../../constants/EntryActionTypes';
|
||||
|
||||
export default function* coreWatchers() {
|
||||
yield all([takeEvery(EntryActionTypes.LOGOUT, () => services.logout())]);
|
||||
yield all([
|
||||
takeEvery(EntryActionTypes.LOGOUT, ({ payload: { invalidateAccessToken } }) =>
|
||||
services.logout(invalidateAccessToken),
|
||||
),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,10 @@ const createSocketEventsChannel = () =>
|
||||
emit(entryActions.handleSocketReconnect());
|
||||
};
|
||||
|
||||
const handleLogout = () => {
|
||||
emit(entryActions.logout(false));
|
||||
};
|
||||
|
||||
const handleUserCreate = api.makeHandleUserCreate(({ item }) => {
|
||||
emit(entryActions.handleUserCreate(item));
|
||||
});
|
||||
@@ -171,6 +175,8 @@ const createSocketEventsChannel = () =>
|
||||
socket.on('disconnect', handleDisconnect);
|
||||
socket.on('reconnect', handleReconnect);
|
||||
|
||||
socket.on('logout', handleLogout);
|
||||
|
||||
socket.on('userCreate', handleUserCreate);
|
||||
socket.on('userUpdate', handleUserUpdate);
|
||||
socket.on('userDelete', handleUserDelete);
|
||||
@@ -227,6 +233,8 @@ const createSocketEventsChannel = () =>
|
||||
socket.off('disconnect', handleDisconnect);
|
||||
socket.off('reconnect', handleReconnect);
|
||||
|
||||
socket.off('logout', handleLogout);
|
||||
|
||||
socket.off('userCreate', handleUserCreate);
|
||||
socket.off('userUpdate', handleUserUpdate);
|
||||
socket.off('userDelete', handleUserDelete);
|
||||
|
||||
+11
-8
@@ -31,14 +31,6 @@ services:
|
||||
# - DEFAULT_ADMIN_NAME=Demo Demo
|
||||
# - DEFAULT_ADMIN_USERNAME=demo
|
||||
|
||||
# Email Notifications (https://nodemailer.com/smtp/)
|
||||
# - SMTP_HOST=
|
||||
# - SMTP_PORT=587
|
||||
# - SMTP_SECURE=true
|
||||
# - SMTP_USER=
|
||||
# - SMTP_PASSWORD=
|
||||
# - SMTP_FROM="Demo Demo" <demo@demo.demo>
|
||||
|
||||
# - OIDC_ISSUER=
|
||||
# - OIDC_CLIENT_ID=
|
||||
# - OIDC_CLIENT_SECRET=
|
||||
@@ -51,6 +43,17 @@ services:
|
||||
# - OIDC_IGNORE_USERNAME=true
|
||||
# - OIDC_IGNORE_ROLES=true
|
||||
# - OIDC_ENFORCED=true
|
||||
|
||||
# Email Notifications (https://nodemailer.com/smtp/)
|
||||
# - SMTP_HOST=
|
||||
# - SMTP_PORT=587
|
||||
# - SMTP_SECURE=true
|
||||
# - SMTP_USER=
|
||||
# - SMTP_PASSWORD=
|
||||
# - SMTP_FROM="Demo Demo" <demo@demo.demo>
|
||||
|
||||
# - SLACK_BOT_TOKEN=
|
||||
# - SLACK_CHANNEL_ID=
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
|
||||
+11
-8
@@ -22,14 +22,6 @@ SECRET_KEY=notsecretkey
|
||||
# DEFAULT_ADMIN_NAME=Demo Demo
|
||||
# DEFAULT_ADMIN_USERNAME=demo
|
||||
|
||||
# Email Notifications (https://nodemailer.com/smtp/)
|
||||
# SMTP_HOST=
|
||||
# SMTP_PORT=587
|
||||
# SMTP_SECURE=true
|
||||
# SMTP_USER=
|
||||
# SMTP_PASSWORD=
|
||||
# SMTP_FROM="Demo Demo" <demo@demo.demo>
|
||||
|
||||
# OIDC_ISSUER=
|
||||
# OIDC_CLIENT_ID=
|
||||
# OIDC_CLIENT_SECRET=
|
||||
@@ -43,6 +35,17 @@ SECRET_KEY=notsecretkey
|
||||
# OIDC_IGNORE_ROLES=true
|
||||
# OIDC_ENFORCED=true
|
||||
|
||||
# Email Notifications (https://nodemailer.com/smtp/)
|
||||
# SMTP_HOST=
|
||||
# SMTP_PORT=587
|
||||
# SMTP_SECURE=true
|
||||
# SMTP_USER=
|
||||
# SMTP_PASSWORD=
|
||||
# SMTP_FROM="Demo Demo" <demo@demo.demo>
|
||||
|
||||
# SLACK_BOT_TOKEN=
|
||||
# SLACK_CHANNEL_ID=
|
||||
|
||||
## Do not edit this
|
||||
|
||||
TZ=UTC
|
||||
|
||||
@@ -9,6 +9,10 @@ module.exports = {
|
||||
deletedAt: new Date().toISOString(),
|
||||
});
|
||||
|
||||
if (this.req.isSocket) {
|
||||
sails.sockets.leaveAll(`@accessToken:${accessToken}`);
|
||||
}
|
||||
|
||||
return {
|
||||
item: accessToken,
|
||||
};
|
||||
|
||||
@@ -47,6 +47,7 @@ module.exports = {
|
||||
|
||||
card = await sails.helpers.cards.deleteOne.with({
|
||||
record: card,
|
||||
user: currentUser,
|
||||
request: this.req,
|
||||
});
|
||||
|
||||
|
||||
@@ -14,6 +14,30 @@ const valuesValidator = (value) => {
|
||||
return true;
|
||||
};
|
||||
|
||||
const buildAndSendSlackMessage = async (user, card, action) => {
|
||||
const cardLink = `<${sails.config.custom.baseUrl}/cards/${card.id}|${card.name}>`;
|
||||
|
||||
let markdown;
|
||||
switch (action.type) {
|
||||
case Action.Types.CREATE_CARD:
|
||||
markdown = `${cardLink} was created by ${user.name} in *${action.data.list.name}*`;
|
||||
|
||||
break;
|
||||
case Action.Types.MOVE_CARD:
|
||||
markdown = `${cardLink} was moved by ${user.name} to *${action.data.toList.name}*`;
|
||||
|
||||
break;
|
||||
case Action.Types.COMMENT_CARD:
|
||||
markdown = `*${user.name}* commented on ${cardLink}:\n>${action.data.text}`;
|
||||
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
await sails.helpers.utils.sendSlackMessage(markdown);
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
inputs: {
|
||||
values: {
|
||||
@@ -67,6 +91,10 @@ module.exports = {
|
||||
),
|
||||
);
|
||||
|
||||
if (sails.config.custom.slackBotToken) {
|
||||
buildAndSendSlackMessage(values.user, values.card, action);
|
||||
}
|
||||
|
||||
return action;
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,9 +1,17 @@
|
||||
const buildAndSendSlackMessage = async (user, card) => {
|
||||
await sails.helpers.utils.sendSlackMessage(`*${card.name}* was deleted by ${user.name}`);
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
inputs: {
|
||||
record: {
|
||||
type: 'ref',
|
||||
required: true,
|
||||
},
|
||||
user: {
|
||||
type: 'ref',
|
||||
required: true,
|
||||
},
|
||||
request: {
|
||||
type: 'ref',
|
||||
},
|
||||
@@ -21,6 +29,10 @@ module.exports = {
|
||||
},
|
||||
inputs.request,
|
||||
);
|
||||
|
||||
if (sails.config.custom.slackBotToken) {
|
||||
buildAndSendSlackMessage(inputs.user, card);
|
||||
}
|
||||
}
|
||||
|
||||
return card;
|
||||
|
||||
@@ -27,6 +27,7 @@ const buildAndSendEmail = async (user, board, card, action, notifiableUser) => {
|
||||
`from ${action.data.fromList.name} to ${action.data.toList.name} ` +
|
||||
`on <a href="${process.env.BASE_URL}/boards/${board.id}">${board.name}</a></p>`,
|
||||
};
|
||||
|
||||
break;
|
||||
case Action.Types.COMMENT_CARD:
|
||||
emailData = {
|
||||
@@ -37,6 +38,7 @@ const buildAndSendEmail = async (user, board, card, action, notifiableUser) => {
|
||||
`on <a href="${process.env.BASE_URL}/boards/${board.id}">${board.name}</a></p>` +
|
||||
`<p>${action.data.text}</p>`,
|
||||
};
|
||||
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
|
||||
@@ -25,7 +25,7 @@ module.exports = {
|
||||
|
||||
sails.log.info('Email sent: %s', info.messageId);
|
||||
} catch (error) {
|
||||
sails.log.error(error);
|
||||
sails.log.error(error); // TODO: provide description text?
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
const POST_MESSAGE_API_URL = 'https://slack.com/api/chat.postMessage';
|
||||
|
||||
module.exports = {
|
||||
inputs: {
|
||||
markdown: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
||||
async fn(inputs) {
|
||||
const headers = {
|
||||
Authorization: `Bearer ${sails.config.custom.slackBotToken}`,
|
||||
'Content-Type': 'application/json; charset=utf-8',
|
||||
};
|
||||
|
||||
const body = {
|
||||
blocks: [
|
||||
{
|
||||
type: 'section',
|
||||
text: {
|
||||
type: 'mrkdwn',
|
||||
text: inputs.markdown,
|
||||
},
|
||||
},
|
||||
],
|
||||
channel: sails.config.custom.slackChannelId,
|
||||
};
|
||||
|
||||
let response;
|
||||
try {
|
||||
response = await fetch(POST_MESSAGE_API_URL, {
|
||||
headers,
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
});
|
||||
} catch (error) {
|
||||
sails.log.error(error); // TODO: provide description text?
|
||||
return;
|
||||
}
|
||||
|
||||
if (!response.ok) {
|
||||
sails.log.error('Error sending to Slack: %s', response.error);
|
||||
return;
|
||||
}
|
||||
|
||||
const responseJson = await response.json();
|
||||
|
||||
if (!responseJson.ok) {
|
||||
sails.log.error('Error sending to Slack: %s', responseJson.error);
|
||||
}
|
||||
},
|
||||
};
|
||||
@@ -61,6 +61,7 @@ module.exports = function defineCurrentUserHook(sails) {
|
||||
});
|
||||
|
||||
if (req.isSocket) {
|
||||
sails.sockets.join(req, `@accessToken:${accessToken}`);
|
||||
sails.sockets.join(req, `@user:${currentUser.id}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
const openidClient = require('openid-client');
|
||||
|
||||
module.exports = function oidcServiceHook(sails) {
|
||||
/**
|
||||
* oidc hook
|
||||
*
|
||||
* @description :: A hook definition. Extends Sails by adding shadow routes, implicit actions,
|
||||
* and/or initialization logic.
|
||||
* @docs :: https://sailsjs.com/docs/concepts/extending-sails/hooks
|
||||
*/
|
||||
|
||||
module.exports = function defineOidcHook(sails) {
|
||||
let client = null;
|
||||
|
||||
return {
|
||||
@@ -9,7 +17,12 @@ module.exports = function oidcServiceHook(sails) {
|
||||
*/
|
||||
|
||||
async initialize() {
|
||||
if (sails.config.custom.oidcIssuer) {
|
||||
if (!sails.config.custom.oidcIssuer) {
|
||||
return;
|
||||
}
|
||||
|
||||
sails.log.info('Initializing custom hook (`oidc`)');
|
||||
|
||||
const issuer = await openidClient.Issuer.discover(sails.config.custom.oidcIssuer);
|
||||
|
||||
client = new issuer.Client({
|
||||
@@ -18,8 +31,6 @@ module.exports = function oidcServiceHook(sails) {
|
||||
redirect_uris: [sails.config.custom.oidcRedirectUri],
|
||||
response_types: ['code'],
|
||||
});
|
||||
sails.log.info('OIDC hook has been loaded successfully');
|
||||
}
|
||||
},
|
||||
|
||||
getClient() {
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
const nodemailer = require('nodemailer');
|
||||
|
||||
module.exports = function smtpServiceHook(sails) {
|
||||
/**
|
||||
* smtp hook
|
||||
*
|
||||
* @description :: A hook definition. Extends Sails by adding shadow routes, implicit actions,
|
||||
* and/or initialization logic.
|
||||
* @docs :: https://sailsjs.com/docs/concepts/extending-sails/hooks
|
||||
*/
|
||||
|
||||
module.exports = function defineSmtpHook(sails) {
|
||||
let transporter = null;
|
||||
|
||||
return {
|
||||
@@ -9,7 +17,12 @@ module.exports = function smtpServiceHook(sails) {
|
||||
*/
|
||||
|
||||
async initialize() {
|
||||
if (sails.config.custom.smtpHost) {
|
||||
if (!sails.config.custom.smtpHost) {
|
||||
return;
|
||||
}
|
||||
|
||||
sails.log.info('Initializing custom hook (`smtp`)');
|
||||
|
||||
transporter = nodemailer.createTransport({
|
||||
pool: true,
|
||||
host: sails.config.custom.smtpHost,
|
||||
@@ -20,8 +33,6 @@ module.exports = function smtpServiceHook(sails) {
|
||||
pass: sails.config.custom.smtpPassword,
|
||||
},
|
||||
});
|
||||
sails.log.info('SMTP hook has been loaded successfully');
|
||||
}
|
||||
},
|
||||
|
||||
getTransporter() {
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* watcher hook
|
||||
*
|
||||
* @description :: A hook definition. Extends Sails by adding shadow routes, implicit actions,
|
||||
* and/or initialization logic.
|
||||
* @docs :: https://sailsjs.com/docs/concepts/extending-sails/hooks
|
||||
*/
|
||||
|
||||
module.exports = function defineWatcherHook(sails) {
|
||||
const checkSocketConnectionsToLogout = () => {
|
||||
Object.keys(sails.io.sockets.adapter.rooms).forEach((room) => {
|
||||
if (!room.startsWith('@accessToken:')) {
|
||||
return;
|
||||
}
|
||||
|
||||
const accessToken = room.split(':')[1];
|
||||
|
||||
try {
|
||||
sails.helpers.utils.verifyToken(accessToken);
|
||||
} catch (error) {
|
||||
sails.sockets.broadcast(room, 'logout');
|
||||
sails.sockets.leaveAll(room);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return {
|
||||
/**
|
||||
* Runs when this Sails app loads/lifts.
|
||||
*/
|
||||
|
||||
async initialize() {
|
||||
sails.log.info('Initializing custom hook (`watcher`)');
|
||||
|
||||
setInterval(checkSocketConnectionsToLogout, 60 * 1000);
|
||||
},
|
||||
};
|
||||
};
|
||||
+10
-7
@@ -34,13 +34,6 @@ module.exports.custom = {
|
||||
defaultAdminEmail:
|
||||
process.env.DEFAULT_ADMIN_EMAIL && process.env.DEFAULT_ADMIN_EMAIL.toLowerCase(),
|
||||
|
||||
smtpHost: process.env.SMTP_HOST,
|
||||
smtpPort: process.env.SMTP_PORT || 587,
|
||||
smtpSecure: process.env.SMTP_SECURE === 'true',
|
||||
smtpUser: process.env.SMTP_USER,
|
||||
smtpPassword: process.env.SMTP_PASSWORD,
|
||||
smtpFrom: process.env.SMTP_FROM,
|
||||
|
||||
oidcIssuer: process.env.OIDC_ISSUER,
|
||||
oidcClientId: process.env.OIDC_CLIENT_ID,
|
||||
oidcClientSecret: process.env.OIDC_CLIENT_SECRET,
|
||||
@@ -58,4 +51,14 @@ module.exports.custom = {
|
||||
oidcRedirectUri: `${
|
||||
sails.config.environment === 'production' ? process.env.BASE_URL : 'http://localhost:3000'
|
||||
}/oidc-callback`,
|
||||
|
||||
smtpHost: process.env.SMTP_HOST,
|
||||
smtpPort: process.env.SMTP_PORT || 587,
|
||||
smtpSecure: process.env.SMTP_SECURE === 'true',
|
||||
smtpUser: process.env.SMTP_USER,
|
||||
smtpPassword: process.env.SMTP_PASSWORD,
|
||||
smtpFrom: process.env.SMTP_FROM,
|
||||
|
||||
slackBotToken: process.env.SLACK_BOT_TOKEN,
|
||||
slackChannelId: process.env.SLACK_CHANNEL_ID,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user