Review main Merged

72825[BUGFIX] Do not overwrite previously set preview mode

Susi Moog CR +2 V +2 Easy +17 −11 updated 01/04/22, 14:22

Commit message

The frontend preview aspect may be set from the admin panel
or the frontend extension or even from a third-party extension
in a middleware. The previous implementation overwrote the preview
settings on every initialisation, resulting in lost preview
information. Instead of overwriting the setting, this change takes
the current preview value into account - if the preview was enabled
by a previous instance this is kept.

Additionally, the logic to set the preview flag in both frontend
and admin panel has been streamlined.

Review

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

Issues 1

Files 3

Review log 1822

  1. Susi Moog uploaded patch set 1 01/02/22, 11:03

  2. Susi Moog commented on patch set 1 01/02/22, 11:04

    Note: on PHP 8.1 (and maybe 8) you'll need https://review.typo3.org/c/Packages/TYPO3.CMS/+/72824 previously to test this.
  3. core-ci voted on patch set 1 V -1 01/02/22, 11:21 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/21548

  4. Susi Moog uploaded patch set 2 01/02/22, 12:26

  5. core-ci voted on patch set 2 V +1 01/02/22, 12:39 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/21550

  6. Rémy DANIEL commented on patch set 2 CR -1 01/02/22, 13:25

    PreviewModule.php:172

    This line should be removed, because the aspect is now properly defined at the end of the method. Also, this line will cause the `if` line 213 to always pass.
  7. Susi Moog commented on patch set 2 01/03/22, 05:57

    PreviewModule.php:172 Reply

    true - a bit too much streamlining here ;) Will fix it, thanks!
  8. Susi Moog uploaded patch set 3 01/03/22, 06:00

  9. core-ci voted on patch set 3 V +1 01/03/22, 06:12 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/21556

  10. Susi Moog commented on patch set 3 01/03/22, 09:09

    PreviewModule.php:172 Reply

    Done
  11. Rémy DANIEL voted on patch set 3 CR +1 01/03/22, 18:36

  12. Christian Kuhn voted on patch set 3 V +1 CR +1 01/04/22, 13:15

  13. Benni Mack commented on patch set 3 CR -1 01/04/22, 13:19

    PreviewSimulator.php:64

    why is this cast to int() in the first place? shouldn't this be a bool() ?
  14. Christian Kuhn commented on patch set 3 V 0 CR 0 01/04/22, 13:20

    PreviewSimulator.php:64 Reply

    Ack
  15. Susi Moog commented on patch set 3 01/04/22, 13:21

    PreviewSimulator.php:64 Reply

    fun for everyone, yes, that has been wrong before, is wrong now and should be fixed in both places. I can take care later if no-one else is faster.
  16. Christian Kuhn uploaded patch set 4 01/04/22, 13:48

  17. Christian Kuhn commented on patch set 4 V +1 CR +1 01/04/22, 13:48

    PreviewSimulator.php:64 Reply

    Done
  18. Benni Mack voted on patch set 4 V +1 CR +1 01/04/22, 13:59

  19. Susi Moog commented on patch set 4 01/04/22, 14:02

    PreviewSimulator.php:64 Reply

    Thank you!
  20. core-ci voted on patch set 4 V +1 01/04/22, 14:04 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/21587

  21. Christian Kuhn commented on patch set 4 V +2 CR +2 01/04/22, 14:21

    PreviewSimulator.php:64 Reply

    Welcome!
  22. Christian Kuhn merged patch set 5 01/04/22, 14:22