- commit
- b0d8f582c01e6dc41d8f400e352286a7a294ea7e
- parent
- a94e835dcec47d7eaffed0efc03ef6859b505f97
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2020-10-18 07:11
via optimize
Diffstat
| M | static/src/voterunner.js | 14 | +++++++++++++- |
1 files changed, 13 insertions, 1 deletions
diff --git a/static/src/voterunner.js b/static/src/voterunner.js
@@ -124,7 +124,10 @@ document.addEventListener('DOMContentLoaded', function() {
124 124 var name = data[0];
125 125 var id = data[1];
126 126
127 -1 if (!id) {
-1 127 if (name === 'setNodes') {
-1 128 state.nodes = data[2];
-1 129 ensureVisible(state.nodes.find(n => n.id === state.id));
-1 130 } else if (!id) {
128 131 return;
129 132 } else if (name === 'rmNode') {
130 133 state.nodes = state.nodes.filter(function(node) {
@@ -145,6 +148,15 @@ document.addEventListener('DOMContentLoaded', function() {
145 148 invalidateVotes();
146 149 }
147 150 update(state);
-1 151
-1 152 if (Math.random() < 0.05) {
-1 153 invalidateVotes();
-1 154 fetch(url, {
-1 155 method: 'PUT',
-1 156 body: JSON.stringify(['setNodes', null, state.nodes]),
-1 157 headers: {'Last-Event-ID': event.lastEventId},
-1 158 });
-1 159 }
148 160 };
149 161
150 162 window.testClear = function(done) {