mirror of
https://github.com/wekan/wekan.git
synced 2025-12-17 07:50:12 +01:00
fix Boards.uniqueTitle
This commit is contained in:
parent
0712309266
commit
a45d1fa855
1 changed files with 18 additions and 18 deletions
|
|
@ -1465,24 +1465,24 @@ Boards.uniqueTitle = title => {
|
||||||
new RegExp('^(?<title>.*?)\\s*(\\[(?<num>\\d+)]\\s*$|\\s*$)'),
|
new RegExp('^(?<title>.*?)\\s*(\\[(?<num>\\d+)]\\s*$|\\s*$)'),
|
||||||
);
|
);
|
||||||
const base = escapeForRegex(m.groups.title);
|
const base = escapeForRegex(m.groups.title);
|
||||||
let num = 0;
|
const baseTitle = m.groups.title;
|
||||||
Boards.find({ title: new RegExp(`^${base}\\s*\\[\\d+]\\s*$`) }).forEach(
|
boards = Boards.find({ title: new RegExp(`^${base}\\s*(\\[(?<num>\\d+)]\\s*$|\\s*$)`) });
|
||||||
board => {
|
if (boards.count() > 0) {
|
||||||
const m = board.title.match(
|
let num = 0;
|
||||||
new RegExp('^(?<title>.*?)\\s*\\[(?<num>\\d+)]\\s*$'),
|
Boards.find({ title: new RegExp(`^${base}\\s*\\[\\d+]\\s*$`) }).forEach(
|
||||||
);
|
board => {
|
||||||
if (m) {
|
const m = board.title.match(
|
||||||
const n = parseInt(m.groups.num, 10);
|
new RegExp('^(?<title>.*?)\\s*\\[(?<num>\\d+)]\\s*$'),
|
||||||
num = num < n ? n : num;
|
);
|
||||||
}
|
if (m) {
|
||||||
},
|
const n = parseInt(m.groups.num, 10);
|
||||||
);
|
num = num < n ? n : num;
|
||||||
|
}
|
||||||
return `${m.groups.title} [${num + 1}]`;
|
},
|
||||||
//if (num > 0) {
|
);
|
||||||
// return `${base} [${num + 1}]`;
|
return `${baseTitle} [${num + 1}]`;
|
||||||
//}
|
}
|
||||||
//return title;
|
return title;
|
||||||
};
|
};
|
||||||
|
|
||||||
Boards.userSearch = (
|
Boards.userSearch = (
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue