Unable to load image
Reported by:

site dev help megathread

from here on out, ill post codecel questions or other shit i need help with here and give mbux rewards appropriately

subscribe to the thread if ur interested

!codecels

88
Jump in the discussion.

No email address required.

Don’t click it twice.

BUG FIXED MY NEIGHBOR

Jump in the discussion.

No email address required.

Open and close the report modal multiple times and check the event listenersβ€”every time the modal is opened, an event listener on the submit button is re-added. You can either directly set the onclick property of the button to make sure that there is only one custom event listener (easy, but kinda awful), or you can remove the event listener every time the modal closes (better approach, use the same thing on line 8 in comments_v.js to get the instance and add the corresponding removeEventListener).

Jump in the discussion.

No email address required.

check's in the mail :marseykneel#:

Jump in the discussion.

No email address required.

throttling submissions would probably be the best way of fixing this, would also prevent people from actually double clicking it. hmm looks like postToast only has a callback for success right? ideally you'd handle enabling it on any response, so i'd probably just patch this with a timer to prevent double submits - either with a variable like this or by disabling the button.

edit: oh didn't realize this was all on window, can probably chuck the canSubmit on reportCommentButton.canSubmit = true in that case

let canSubmit = true;
reportCommentButton.addEventListener('click', function() {
	if (!canSubmit) return;
	canSubmit = false;
	setTimeout( function() {
		canSubmit = true;
	}, 1000 );

	this.innerHTML='Reporting comment';

	postToast(this, `/report/comment/${id}`,
		{
			"reason": reason_comment.value
		},
		() => { canSubmit = true }
	);
})
Jump in the discussion.

No email address required.

Link copied to clipboard
Action successful!
Error, please refresh the page and try again.