mirror of
https://github.com/wekan/wekan.git
synced 2026-02-03 07:01:47 +01:00
Merge branch 'master' of https://github.com/wekan/wekan
This commit is contained in:
commit
52e45211a2
37 changed files with 7053 additions and 134 deletions
|
|
@ -210,15 +210,30 @@ if (Meteor.isServer) {
|
|||
// ignore commenter mention himself?
|
||||
continue;
|
||||
}
|
||||
const atUser = _.findWhere(knownUsers, { username });
|
||||
if (!atUser) {
|
||||
continue;
|
||||
|
||||
if (activity.boardId && username === 'board_members') {
|
||||
// mentions all board members
|
||||
const knownUids = knownUsers.map(u => u.userId);
|
||||
watchers = _.union(watchers, [...knownUids]);
|
||||
title = 'act-atUserComment';
|
||||
} else if (activity.cardId && username === 'card_members') {
|
||||
// mentions all card members if assigned
|
||||
const card = activity.card();
|
||||
watchers = _.union(watchers, [...card.members]);
|
||||
title = 'act-atUserComment';
|
||||
} else {
|
||||
const atUser = _.findWhere(knownUsers, { username });
|
||||
if (!atUser) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const uid = atUser.userId;
|
||||
params.atUsername = username;
|
||||
params.atEmails = atUser.emails;
|
||||
title = 'act-atUserComment';
|
||||
watchers = _.union(watchers, [uid]);
|
||||
}
|
||||
const uid = atUser.userId;
|
||||
params.atUsername = username;
|
||||
params.atEmails = atUser.emails;
|
||||
title = 'act-atUserComment';
|
||||
watchers = _.union(watchers, [uid]);
|
||||
|
||||
}
|
||||
}
|
||||
params.commentId = comment._id;
|
||||
|
|
|
|||
|
|
@ -375,6 +375,14 @@ Boards.attachSchema(
|
|||
defaultValue: true,
|
||||
},
|
||||
|
||||
allowsCardNumber: {
|
||||
/**
|
||||
* Does the board allows card numbers?
|
||||
*/
|
||||
type: Boolean,
|
||||
defaultValue: false,
|
||||
},
|
||||
|
||||
allowsActivities: {
|
||||
/**
|
||||
* Does the board allows comments?
|
||||
|
|
@ -1056,6 +1064,26 @@ Boards.helpers({
|
|||
return result;
|
||||
},
|
||||
|
||||
getNextCardNumber() {
|
||||
const boardCards = Cards.find(
|
||||
{
|
||||
boardId: this._id
|
||||
},
|
||||
{
|
||||
sort: { cardNumber: -1 },
|
||||
limit: 1
|
||||
}
|
||||
).fetch();
|
||||
|
||||
// If no card is assigned to the board, return 1
|
||||
if (!boardCards || boardCards.length === 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
const maxCardNr = !!boardCards[0].cardNumber ? boardCards[0].cardNumber : 0;
|
||||
return maxCardNr + 1;
|
||||
},
|
||||
|
||||
cardsDueInBetween(start, end) {
|
||||
return Cards.find({
|
||||
boardId: this._id,
|
||||
|
|
@ -1285,6 +1313,10 @@ Boards.mutations({
|
|||
return { $set: { allowsDescriptionTitle } };
|
||||
},
|
||||
|
||||
setAllowsCardNumber(allowsCardNumber) {
|
||||
return { $set: { allowsCardNumber } };
|
||||
},
|
||||
|
||||
setAllowsDescriptionText(allowsDescriptionText) {
|
||||
return { $set: { allowsDescriptionText } };
|
||||
},
|
||||
|
|
|
|||
|
|
@ -470,6 +470,16 @@ Cards.attachSchema(
|
|||
optional: true,
|
||||
defaultValue: [],
|
||||
},
|
||||
cardNumber: {
|
||||
/**
|
||||
* A boardwise sequentially increasing number that is assigned
|
||||
* to every newly created card
|
||||
*/
|
||||
type: Number,
|
||||
decimal: true,
|
||||
optional: true,
|
||||
defaultValue: 0,
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
|
|
@ -567,6 +577,7 @@ Cards.helpers({
|
|||
|
||||
delete this._id;
|
||||
this.boardId = boardId;
|
||||
this.cardNumber = Boards.findOne(boardId).getNextCardNumber();
|
||||
this.swimlaneId = swimlaneId;
|
||||
this.listId = listId;
|
||||
const _id = Cards.insert(this);
|
||||
|
|
@ -1647,6 +1658,10 @@ Cards.helpers({
|
|||
}
|
||||
},
|
||||
|
||||
getCardNumber() {
|
||||
return this.cardNumber;
|
||||
},
|
||||
|
||||
getBoardTitle() {
|
||||
if (this.isLinkedCard()) {
|
||||
const card = Cards.findOne({ _id: this.linkedId });
|
||||
|
|
@ -1975,8 +1990,12 @@ Cards.mutations({
|
|||
'_id',
|
||||
);
|
||||
|
||||
// assign the new card number from the target board
|
||||
const newCardNumber = newBoard.getNextCardNumber();
|
||||
|
||||
Object.assign(mutatedFields, {
|
||||
labelIds: newCardLabelIds,
|
||||
cardNumber: newCardNumber
|
||||
});
|
||||
|
||||
mutatedFields.customFields = this.mapCustomFieldsToBoard(newBoard._id);
|
||||
|
|
@ -3207,6 +3226,8 @@ if (Meteor.isServer) {
|
|||
Authentication.checkAdminOrCondition(req.userId, addPermission);
|
||||
const paramListId = req.params.listId;
|
||||
const paramParentId = req.params.parentId;
|
||||
|
||||
const nextCardNumber = board.getNextCardNumber();
|
||||
const currentCards = Cards.find(
|
||||
{
|
||||
listId: paramListId,
|
||||
|
|
@ -3229,6 +3250,7 @@ if (Meteor.isServer) {
|
|||
userId: req.body.authorId,
|
||||
swimlaneId: req.body.swimlaneId,
|
||||
sort: currentCards.count(),
|
||||
cardNumber: nextCardNumber,
|
||||
members,
|
||||
assignees,
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue