Only add button classes to actions that actually are buttons

This commit is contained in:
Andreas Nedbal 2022-06-25 13:04:24 +02:00 committed by Karina Kwiatek
parent d8b1bb3882
commit 2e9b3e882d
1 changed files with 8 additions and 4 deletions

View File

@ -61,15 +61,19 @@ export function userActionHandler(event: Event): void {
case 'block': case 'block':
button.dataset.action = 'unblock'; button.dataset.action = 'unblock';
button.querySelector('span').innerText = I18n.translate('views.actions.unblock'); button.querySelector('span').innerText = I18n.translate('views.actions.unblock');
if (button.classList.contains('btn')) {
button.classList.remove('btn-primary'); button.classList.remove('btn-primary');
button.classList.add('btn-default'); button.classList.add('btn-default');
}
resetFollowButton(document.querySelector<HTMLButtonElement>('button[data-action="unfollow"]')); resetFollowButton(document.querySelector<HTMLButtonElement>('button[data-action="unfollow"]'));
break; break;
case 'unblock': case 'unblock':
button.dataset.action = 'block'; button.dataset.action = 'block';
button.querySelector('span').innerText = I18n.translate('views.actions.block'); button.querySelector('span').innerText = I18n.translate('views.actions.block');
if (button.classList.contains('btn')) {
button.classList.remove('btn-default'); button.classList.remove('btn-default');
button.classList.add('btn-primary'); button.classList.add('btn-primary');
}
break; break;
} }
} }