- commit
- d30662559fdd8ae88f9c0cee6b94f70207426d23
- parent
- 20976f353c32288f52a361876b42f26cd353e295
- Author
- Tobias Bengfort <tobias.bengfort@gmx.net>
- Date
- 2016-09-09 15:12
fix: do not create empty nodes
Diffstat
| M | static/src/voterunner.js | 9 | ++++++++- |
1 files changed, 8 insertions, 1 deletions
diff --git a/static/src/voterunner.js b/static/src/voterunner.js
@@ -254,7 +254,14 @@ document.addEventListener('DOMContentLoaded', function() {
254 254
255 255 var pushComment = throttle(function() {
256 256 var comment = document.querySelector('#comment textarea').value;
257 -1 socket.emit('setNodeComment', comment);
-1 257 var node = nodes.find(function(n) {
-1 258 return n.id === ID;
-1 259 });
-1 260 // Do not create a new node if the comment is empty.
-1 261 // This can happen e.g. on a keydown event from the ctrl or shift keys.
-1 262 if (node || comment) {
-1 263 socket.emit('setNodeComment', comment);
-1 264 }
258 265 }, 1000);
259 266
260 267 document.querySelector('#comment textarea').addEventListener('change', pushComment);