From b926820d903027b6afaafc8d734d553a79735d2d Mon Sep 17 00:00:00 2001 From: Georg Gadinger Date: Sat, 18 Apr 2020 23:44:59 +0200 Subject: [PATCH] javascripts: "fix" (un)smile update bug --- .../javascripts/answerbox/comment/smile.coffee | 18 ++++++++++-------- app/assets/javascripts/answerbox/smile.coffee | 18 ++++++++++-------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/app/assets/javascripts/answerbox/comment/smile.coffee b/app/assets/javascripts/answerbox/comment/smile.coffee index 6b25dfa6..a85da543 100644 --- a/app/assets/javascripts/answerbox/comment/smile.coffee +++ b/app/assets/javascripts/answerbox/comment/smile.coffee @@ -31,11 +31,13 @@ $(document).on "click", "button[name=ab-smile-comment]", -> showNotification translate('frontend.error.message'), false complete: (jqxhr, status) -> btn.button "reset" - if success - switch action - when 'smile' - btn[0].dataset.action = 'unsmile' - btn.html " #{count}" - when 'unsmile' - btn[0].dataset.action = 'smile' - btn.html " #{count}" + window.setTimeout -> + if success + switch action + when 'smile' + btn[0].dataset.action = 'unsmile' + btn.html " #{count}" + when 'unsmile' + btn[0].dataset.action = 'smile' + btn.html " #{count}" + , 20 diff --git a/app/assets/javascripts/answerbox/smile.coffee b/app/assets/javascripts/answerbox/smile.coffee index ed26ec5f..8a9b9769 100644 --- a/app/assets/javascripts/answerbox/smile.coffee +++ b/app/assets/javascripts/answerbox/smile.coffee @@ -31,11 +31,13 @@ $(document).on "click", "button[name=ab-smile]", -> showNotification translate('frontend.error.message'), false complete: (jqxhr, status) -> btn.button "reset" - if success - switch action - when 'smile' - btn[0].dataset.action = 'unsmile' - btn.html " #{count}" - when 'unsmile' - btn[0].dataset.action = 'smile' - btn.html " #{count}" + window.setTimeout -> + if success + switch action + when 'smile' + btn[0].dataset.action = 'unsmile' + btn.html " #{count}" + when 'unsmile' + btn[0].dataset.action = 'smile' + btn.html " #{count}" + , 20