bug/63897 Missing target element "internalCheckbox" error when internal comments feature is disabled (#18856)

On wp comment form submit end, safely toggle internal comment state

https://community.openproject.org/wp/63897

When the Internal comments feature is disabled, the internalCommentCheckboxTarget does not exist, causing a warning from Stimulus; the InternalCommentController listens to form submit end events from the activities IndexController which manages comment form submission- it is then able to update the UI state on form close. E.g. Ensuring that the background color is reset https://github.com/opf/openproject/commit/e4270942f935c127bf322955933c7bb81b93192b
This commit is contained in:
Kabiru Mwenja
2025-05-12 14:52:52 +03:00
committed by GitHub
parent 2b066ed705
commit 5a5b9287c6
@@ -51,8 +51,12 @@ export default class InternalCommentController extends Controller {
declare isInternalValue:boolean;
declare hasInternalCheckboxTarget:boolean;
onSubmitEnd(_event:CustomEvent):void {
this.toggleInternal();
if (this.hasInternalCheckboxTarget) {
this.toggleInternal();
}
}
toggleInternal():void {