summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenton Hamaluik <kenton@hamaluik.com>2015-10-08 12:22:03 -0600
committerKenton Hamaluik <kenton@hamaluik.com>2015-10-08 12:22:03 -0600
commit77ca52d8c20211170a0f6d28e751768a4f9c3b8c (patch)
tree5811b80c70365eff841bb74a65717caddbcd19bc
parente4c5d2cbe64f42f1fc2e49aea6a9a25bc0d686cb (diff)
downloadwekan-77ca52d8c20211170a0f6d28e751768a4f9c3b8c.tar.gz
wekan-77ca52d8c20211170a0f6d28e751768a4f9c3b8c.tar.bz2
wekan-77ca52d8c20211170a0f6d28e751768a4f9c3b8c.zip
Fixed issue with possible race condition, suggested by @mquandalle
-rw-r--r--client/components/lists/listBody.js12
1 files changed, 4 insertions, 8 deletions
diff --git a/client/components/lists/listBody.js b/client/components/lists/listBody.js
index 61e26975..7c524b93 100644
--- a/client/components/lists/listBody.js
+++ b/client/components/lists/listBody.js
@@ -45,11 +45,9 @@ BlazeComponent.extendComponent({
let foundUserIds = []; // eslint-disable-line prefer-const
currentBoard.members.forEach((member) => {
const username = Users.findOne(member.userId).username;
- const nameNdx = title.indexOf(`@${username}`);
- if(nameNdx !== -1) {
+ if(title.indexOf(`@${username}`) !== -1) {
foundUserIds.push(member.userId);
- title = title.substr(0, nameNdx)
- + title.substr(nameNdx + username.length + 1);
+ title = title.replace(`@${username}`, '');
}
});
@@ -59,11 +57,9 @@ BlazeComponent.extendComponent({
currentBoard.labels.forEach((label) => {
const labelName = (!label.name || label.name === '')
? label.color : label.name;
- const labelNdx = title.indexOf(`#${labelName}`);
- if(labelNdx !== -1) {
+ if(title.indexOf(`#${labelName}`) !== -1) {
foundLabelIds.push(label._id);
- title = title.substr(0, labelNdx)
- + title.substr(labelNdx + labelName.length + 1);
+ title = title.replace(`#${labelName}`, '');
}
});