Fix logged-out users sending wrong data to question endpoint

This commit is contained in:
Andreas Nedbal 2022-07-08 23:19:36 +02:00 committed by Karina Kwiatek
parent c6530cc4e7
commit 851c74f228
1 changed files with 6 additions and 1 deletions

View File

@ -5,7 +5,12 @@ import I18n from 'retrospring/i18n';
export function questionboxUserHandler(event: Event): void {
const button = event.target as HTMLButtonElement;
const promote = button.dataset.promote === "true";
const anonymousQuestion = document.querySelector<HTMLInputElement>('input[name=qb-anonymous]')?.checked;
const anonymousInput = document.querySelector<HTMLInputElement>('input[name=qb-anonymous]');
let anonymousQuestion = true;
if (anonymousInput) {
anonymousQuestion = anonymousInput.checked;
}
document.querySelector<HTMLInputElement>('textarea[name=qb-question]').readOnly = true;
button.disabled = true;