ILIAS icon indicating copy to clipboard operation
ILIAS copied to clipboard

[FIX] removed duplicate showMessageForm() call.

Open thibsy opened this issue 3 years ago • 3 comments

Hi @pascalseeland

@mjansenDatabay drew my attention to the (IMO redundant showMessageForm call) within the callback I introduced while implementing the CallbackDuration, so I felt kind of responsible for leaving this code-snippet in there. First we thought the method-call triggers a RuntimeException due to the new shutdown-function of the HTTP-service, but then we realized that ilGlobalTemplate::printToStdout doesn't contain an exit-statement (anymore?).

Anyways, the showMessageForm will also be called after the callback finished.

Kind regards!

thibsy avatar Sep 23 '22 13:09 thibsy

P.S. if I'm wrong about it's redundancy you can close this PR, theres no real issue with the code AFAIK.

thibsy avatar Sep 23 '22 13:09 thibsy

IMO the call is not redundant.

I see two options to fix this:

Option 1) Pass a &$rendered (initially false) flag to the callback and set it to true if something within the callback renders/prints HTML. Outside the callback, check if !$rendered and call $this->showMessageForm(sprintf($this->lng->txt('pwassist_mail_sent'), $form->getInput('email'))); like it is done now. Option 2) Move the $this->showMessageForm(sprintf($this->lng->txt('pwassist_mail_sent'), $form->getInput('email'))); to the callback

mjansenDatabay avatar Sep 23 '22 14:09 mjansenDatabay

@mjansenDatabay sorry for the late response, but I just checked and the call is redundant and leads to the page being printed to stdout twice (only visible when inspecting the page-source) if the user-id wasn't found. I therefore changed the label to bugfix as well because this could lead to signals not working since all IDs are used twice. I also think the intention of the showMessageForm I removed was to stop execution at this point, since the user-id is invalid.

thibsy avatar Oct 10 '22 08:10 thibsy

LGTM @thibsy

mjansenDatabay avatar Jan 09 '23 10:01 mjansenDatabay