diff options
author | Marcos Barrera <elyomarcos@gmail.com> | 2018-10-04 13:47:40 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-10-04 13:47:40 +0000 |
commit | 4b5e00a848bb55ea8494c61d4a4744a7ead86c79 (patch) | |
tree | ac0b8f459889d5ef4aef509670a1d8111fd587ac /app/assets/javascripts/pages | |
parent | 7876a7397d6ebcef35cbf2a9f92c5a50e492369c (diff) | |
download | gitlab-ce-4b5e00a848bb55ea8494c61d4a4744a7ead86c79.tar.gz |
Resolve "Error while updating todo status: the button is stuck in the loading state"
Diffstat (limited to 'app/assets/javascripts/pages')
-rw-r--r-- | app/assets/javascripts/pages/dashboard/todos/index/todos.js | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/app/assets/javascripts/pages/dashboard/todos/index/todos.js b/app/assets/javascripts/pages/dashboard/todos/index/todos.js index 9aa83ce6269..72f3f70b98f 100644 --- a/app/assets/javascripts/pages/dashboard/todos/index/todos.js +++ b/app/assets/javascripts/pages/dashboard/todos/index/todos.js @@ -79,10 +79,13 @@ export default class Todos { .then(({ data }) => { this.updateRowState(target); this.updateBadges(data); - }).catch(() => flash(__('Error updating todo status.'))); + }).catch(() => { + this.updateRowState(target, true); + return flash(__('Error updating todo status.')); + }); } - updateRowState(target) { + updateRowState(target, isInactive = false) { const row = target.closest('li'); const restoreBtn = row.querySelector('.js-undo-todo'); const doneBtn = row.querySelector('.js-done-todo'); @@ -91,7 +94,10 @@ export default class Todos { target.removeAttribute('disabled'); target.classList.remove('disabled'); - if (target === doneBtn) { + if (isInactive === true) { + restoreBtn.classList.add('hidden'); + doneBtn.classList.remove('hidden'); + } else if (target === doneBtn) { row.classList.add('done-reversible'); restoreBtn.classList.remove('hidden'); } else if (target === restoreBtn) { |