summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorKenton Hamaluik <kenton@hamaluik.com>2015-10-08 12:25:58 -0600
committerKenton Hamaluik <kenton@hamaluik.com>2015-10-08 12:25:58 -0600
commitc2cb17c5dff153fb5b11572036f8acc3155ea7e3 (patch)
treec53bbf5a2bad2d002897cb2bfeeac145054982cc /client
parenta212b1310cf5c722a397e2c50af9a7b289e77e5a (diff)
downloadwekan-c2cb17c5dff153fb5b11572036f8acc3155ea7e3.tar.gz
wekan-c2cb17c5dff153fb5b11572036f8acc3155ea7e3.tar.bz2
wekan-c2cb17c5dff153fb5b11572036f8acc3155ea7e3.zip
Now cards with *only* metadata aren't created empty
Diffstat (limited to 'client')
-rw-r--r--client/components/lists/listBody.js54
1 files changed, 27 insertions, 27 deletions
diff --git a/client/components/lists/listBody.js b/client/components/lists/listBody.js
index ce095ed6..6c191a71 100644
--- a/client/components/lists/listBody.js
+++ b/client/components/lists/listBody.js
@@ -34,35 +34,35 @@ BlazeComponent.extendComponent({
} else if (position === 'bottom') {
sortIndex = Utils.calculateIndex(lastCardDom, null).base;
}
+
+ // Parse for @user and #label mentions, stripping them from the title
+ // and applying the appropriate users and labels to the card instead.
+ const currentBoard = Boards.findOne(Session.get('currentBoard'));
+
+ // Find all @-mentioned usernames, collect a list of their IDs and strip
+ // their mention out of the title.
+ let foundUserIds = []; // eslint-disable-line prefer-const
+ currentBoard.members.forEach((member) => {
+ const username = Users.findOne(member.userId).username;
+ if (title.indexOf(`@${username}`) !== -1) {
+ foundUserIds.push(member.userId);
+ title = title.replace(`@${username}`, '');
+ }
+ });
- if ($.trim(title)) {
- // Parse for @user and #label mentions, stripping them from the title
- // and applying the appropriate users and labels to the card instead.
- const currentBoard = Boards.findOne(Session.get('currentBoard'));
-
- // Find all @-mentioned usernames, collect a list of their IDs and strip
- // their mention out of the title.
- let foundUserIds = []; // eslint-disable-line prefer-const
- currentBoard.members.forEach((member) => {
- const username = Users.findOne(member.userId).username;
- if (title.indexOf(`@${username}`) !== -1) {
- foundUserIds.push(member.userId);
- title = title.replace(`@${username}`, '');
- }
- });
-
- // Find all #-mentioned labels (based on their colour or name), collect a
- // list of their IDs, and strip their mention out of the title.
- let foundLabelIds = []; // eslint-disable-line prefer-const
- currentBoard.labels.forEach((label) => {
- const labelName = (!label.name || label.name === '')
- ? label.color : label.name;
- if (title.indexOf(`#${labelName}`) !== -1) {
- foundLabelIds.push(label._id);
- title = title.replace(`#${labelName}`, '');
- }
- });
+ // Find all #-mentioned labels (based on their colour or name), collect a
+ // list of their IDs, and strip their mention out of the title.
+ let foundLabelIds = []; // eslint-disable-line prefer-const
+ currentBoard.labels.forEach((label) => {
+ const labelName = (!label.name || label.name === '')
+ ? label.color : label.name;
+ if (title.indexOf(`#${labelName}`) !== -1) {
+ foundLabelIds.push(label._id);
+ title = title.replace(`#${labelName}`, '');
+ }
+ });
+ if ($.trim(title)) {
const _id = Cards.insert({
title,
listId: this.data()._id,