1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-19 21:29:43 +02:00

Project managers, board members, auto-update after reconnection, refactoring

This commit is contained in:
Maksim Eltyshev 2021-06-24 01:05:22 +05:00
parent d6cb1f6683
commit b39119ace4
478 changed files with 21226 additions and 19495 deletions

View file

@ -23,31 +23,28 @@ module.exports = {
},
},
async fn(inputs, exits) {
async fn(inputs) {
const { currentUser } = this.req;
const { card, project } = await sails.helpers
.getCardToProjectPath(inputs.cardId)
const { card } = await sails.helpers.cards
.getProjectPath(inputs.cardId)
.intercept('pathNotFound', () => Errors.CARD_NOT_FOUND);
const isUserMemberForProject = await sails.helpers.isUserMemberForProject(
project.id,
currentUser.id,
);
const isBoardMember = await sails.helpers.users.isBoardMember(currentUser.id, card.boardId);
if (!isUserMemberForProject) {
if (!isBoardMember) {
throw Errors.CARD_NOT_FOUND; // Forbidden
}
const values = {
type: 'commentCard',
type: Action.Types.COMMENT_CARD,
data: _.pick(inputs, ['text']),
};
const action = await sails.helpers.createAction(card, currentUser, values, this.req);
const action = await sails.helpers.actions.createOne(values, currentUser, card, this.req);
return exits.success({
return {
item: action,
});
};
},
};