Review main Merged

71714[BUGFIX] Fix rendering of specific format body in FluidEmail

Oli Bartsch CR +2 V +2 Normal +157 −3 updated 11/03/21, 11:55

Commit message

Previously it was not possible to trigger the email
body generation for a specific format, since FluidEmail
only implements the getBody() method, which
generates the body for all configured formats.

To allow triggering a specific body generation,
the methods getHtmlBody() and getTextBody()
are now implemented by FluidEmail, generating
their corresponding body, if the "force" argument
is set. The argument defaults to FALSE to be b/w
compatible.

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Jochen Roth +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Jochen Roth +1
    • core-ci +1 CI

Issues 1

Files 6

Review log 910

  1. Oli Bartsch uploaded patch set 1 10/14/21, 10:30

  2. Mathias Brodala commented on patch set 1 10/14/21, 10:36

    FluidEmail.php:150

    I'm not too fond of adding a proprietary argument here which must be set explicitly and also checked if it exists at all and finally deprecated and dropped again. What problem do you see exactly by triggering the rendering? I'd mostly recommend to split the actual rendering since generateTemplatedBody() currently does too much at once (including setting a subject which is unrelated to the body). Then maybe rendering of the HTML/text body could be done by these two methods and called in getBody() if necessary.
  3. Oli Bartsch commented on patch set 1 10/14/21, 10:49

    FluidEmail.php:150 Reply Unresolved

    > What problem do you see exactly by triggering the rendering? As I wrote in the issue, this is/was actually just a getter method. Devs usually would not expect to trigger any rendering when calling a getter. I'm also pretty sure this method is called in extension code for exactly this purpose => get the current $html content - if set. In case extensions rely on this method to return NULL, in case no rendering was done beforehand, this would be a breaking change. > I'd mostly recommend to split the actual rendering since generateTemplatedBody() currently does too much at once Fully with you, but IMO not part of this patch.
  4. core-ci voted on patch set 1 V +1 10/14/21, 10:50 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/18098

  5. Jochen Roth voted on patch set 1 V +1 CR +1 10/14/21, 15:53

  6. Guido Schmechel commented on patch set 1 10/24/21, 11:25

    FluidEmail.php:178

    What happens if we pass a wrong format here, such as "text". Do we need to secure this more? Then I would also expect a test. Or e.g. define "txt" as the default for forceFormat?
  7. Oli Bartsch commented on patch set 1 11/02/21, 09:32

    FluidEmail.php:178 Reply

    Where do we pass a wrong format? This is a protected method, called with static values only. Anyways, if an invalid format is given, simply no template body is generated. This is done by the "in_array" checks and is also the same behaviour as if $this->format would contain invalid values.
  8. Guido Schmechel commented on patch set 1 11/02/21, 09:59

    FluidEmail.php:178 Reply

    Sorry, I had a different passage in mind. Therefore everything fine!
  9. Christian Kuhn voted on patch set 1 V +2 CR +2 11/03/21, 11:54

  10. Christian Kuhn merged patch set 2 11/03/21, 11:55