From e565df2915615a07f72088aaa0303a21d7a57c97 Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Sat, 8 Jan 2022 03:13:06 +0100 Subject: [PATCH] Fix TSLint nits --- app/javascript/retrospring/features/moderation/vote.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/javascript/retrospring/features/moderation/vote.ts b/app/javascript/retrospring/features/moderation/vote.ts index b5c07edd..308326ef 100644 --- a/app/javascript/retrospring/features/moderation/vote.ts +++ b/app/javascript/retrospring/features/moderation/vote.ts @@ -41,12 +41,14 @@ export function voteReportHandler(event: Event): void { }, complete: () => { if (success) { + const inverseVoteButton = document.querySelector(`[name=mod-vote][data-id="${id}"][data-vote-type="${ upvote ? 'downvote' : 'upvote' }"]`); + const inverseUnvoteButton = document.querySelector(`[name=mod-vote][data-id="${id}"][data-vote-type="${ upvote ? 'downvote' : 'upvote' }"]`); + switch (action) { case 'vote': button.disabled = true; button.dataset.action = 'unvote'; - const inverseVoteButton = document.querySelector(`[name=mod-vote][data-id="${id}"][data-vote-type="${ upvote ? 'downvote' : 'upvote' }"]`); inverseVoteButton.disabled = false; inverseVoteButton.dataset.action = 'unvote'; break; @@ -54,7 +56,6 @@ export function voteReportHandler(event: Event): void { button.disabled = false; button.dataset.action = 'vote'; - const inverseUnvoteButton = document.querySelector(`[name=mod-vote][data-id="${id}"][data-vote-type="${ upvote ? 'downvote' : 'upvote' }"]`); inverseUnvoteButton.disabled = false; inverseUnvoteButton.dataset.action = 'vote'; break;