mirror of
https://github.com/wekan/wekan.git
synced 2025-12-17 16:00:13 +01:00
Insert new boards at last position
This commit is contained in:
parent
1a065ff351
commit
b42d8346cd
1 changed files with 8 additions and 0 deletions
|
|
@ -1295,6 +1295,14 @@ if (Meteor.isServer) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Insert new board at last position in sort order.
|
||||||
|
Boards.before.insert((userId, doc) => {
|
||||||
|
const lastBoard = Boards.findOne({ sort: { $exists: true } }, { sort: { sort: -1 } });
|
||||||
|
if (lastBoard && typeof lastBoard.sort !== 'undefined') {
|
||||||
|
doc.sort = lastBoard.sort + 1;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if (Meteor.isServer) {
|
if (Meteor.isServer) {
|
||||||
// Let MongoDB ensure that a member is not included twice in the same board
|
// Let MongoDB ensure that a member is not included twice in the same board
|
||||||
Meteor.startup(() => {
|
Meteor.startup(() => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue