Review main Merged Breaking

78188[!!!][TASK] Convert JsConfirmation to BitSet

Thomas Hohn CR +2 V +2 Normal +114 −132 updated 08/01/23, 11:38

Commit message

This change converts class JsConfirmation a BitSet.

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Oliver Klee +1
    • Alexander Schnitzler +1
  • Verified V +2 Done
    • Benni Mack +2
    • Alexander Schnitzler +1
    • core-ci +1 CI

Issues 1

Files 12

Review log 4355

Show 2330 earlier messages
  1. Thomas Hohn uploaded patch set 1 03/20/23, 20:24

  2. core-ci voted on patch set 1 V -1 03/20/23, 20:50 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/39276

  3. Georg Ringer commented on patch set 1 03/20/23, 20:53

    JsConfirmation.php:24

    isn'T that breaking?
  4. Thomas Hohn uploaded patch set 2 V -1 03/21/23, 04:55

  5. core-ci voted on patch set 2 V +1 03/21/23, 05:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/39295

  6. Alexander Schnitzler commented on patch set 2 03/21/23, 06:20

    JsConfirmation.php:24

    Not really sure why this had been an enumeration in the first place when placed in the Bitmask folder but a bitmask is something different than an enum. We have a class for BitSets/Masks in place, which is documented here: https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/10.0/Feature-87665-IntroduceBitSetClass.html So if this class is supposed to act like one, I'd rather convert it to a BitSet instead of an enum. If it's an enum and we don't need the functionality of a BitSet, I'd opt for moving the file into a different folder and use human readable integer values for the cases instead of the byte notation.
  7. Andreas Kienast commented on patch set 2 CR -1 03/21/23, 08:24

    This is a breaking change. JsConfirmation is no internal class and might be used by 3rd party extensions.
  8. Thomas Hohn commented on patch set 2 03/23/23, 04:40

    Reply

    Will postpone it to V13 then
  9. Alexander Schnitzler wrote 04/01/23, 17:17

    Removed cc Alexander Schnitzler.
  10. Thomas Hohn uploaded patch set 3 CR -1 V +1 06/21/23, 07:54

  11. core-ci voted on patch set 3 V +1 06/21/23, 08:02 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42866

  12. Thomas Hohn uploaded patch set 4 V +1 06/23/23, 07:01

  13. core-ci voted on patch set 4 V +1 06/23/23, 07:10 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42925

  14. Thomas Hohn uploaded patch set 5 V +1 06/23/23, 07:11

  15. Thomas Hohn commented on patch set 5 06/23/23, 07:12

    JsConfirmation.php:24 Reply

    Added breaking rst

    JsConfirmation.php:24 Reply

    Done
  16. Thomas Hohn commented on patch set 5 06/23/23, 07:12

    Reply

    Added rst
  17. core-ci voted on patch set 5 V +1 06/23/23, 07:18 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42927

  18. Thomas Hohn commented on patch set 5 06/23/23, 20:26

    JsConfirmation.php:24 Reply

    Done
  19. Benni Mack commented on patch set 5 07/04/23, 20:05

    Breaking-100229-ConvertJSConfirmationToBitSet.rst:22

    I do not understand this sentence - what is the impact?
  20. Thomas Hohn commented on patch set 5 07/04/23, 20:50

    Breaking-100229-ConvertJSConfirmationToBitSet.rst:22 Reply

    I guess that all static methods (from the old Enumeration) except the compare method which is kept can't be invoked. Does this make sense - or else feel free to rephrase it :)
  21. Thomas Hohn uploaded patch set 6 V +1 07/05/23, 04:55

  22. Thomas Hohn commented on patch set 6 07/05/23, 04:56

    Breaking-100229-ConvertJSConfirmationToBitSet.rst:22 Reply

    Hope it's clearer now
  23. core-ci voted on patch set 6 V +1 07/05/23, 05:03 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43454

  24. Oliver Klee commented on patch set 6 07/05/23, 08:30

    Breaking-100229-ConvertJSConfirmationToBitSet.rst:22 Reply

    I'm also having trouble understanding this sentence, and I'll try to help (and understand it). :-) Do you mean that all method calls that call methods of the old class should be changed to call the same method of the new class, with the exception of the compare method?
  25. Thomas Hohn commented on patch set 6 07/05/23, 08:40

    Breaking-100229-ConvertJSConfirmationToBitSet.rst:22 Reply

    No - the other way around. It's no longer possible to call any of the old methods except for the compare method :-)
  26. Thomas Hohn uploaded patch set 7 V +1 07/06/23, 04:50

  27. Thomas Hohn commented on patch set 7 07/06/23, 04:51

    Breaking-100229-ConvertJSConfirmationToBitSet.rst:22 Reply

    Did a second attempt
  28. core-ci voted on patch set 7 V +1 07/06/23, 04:58 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43654

  29. Thomas Hohn commented on patch set 7 07/06/23, 13:34

    Breaking-100229-ConvertJSConfirmationToBitSet.rst:22 Reply

    Done
  30. Thomas Hohn rebased onto patch set 8 V +1 07/06/23, 13:34

  1. core-ci voted on patch set 8 V +1 07/06/23, 13:45 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43744

  2. Oliver Klee commented on patch set 9 V +1 07/15/23, 11:34

    Published edit on patch set 8.
  3. Oliver Klee voted on patch set 9 CR +1 07/15/23, 11:34

  4. core-ci voted on patch set 9 V +1 07/15/23, 11:41 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44171

  5. Alexander Schnitzler commented on patch set 9 CR -1 07/21/23, 13:16

    JsConfirmation.php:18

    Don't we have a better namespace to put this class into? Seems to be pretty much tied to `BackendUserAuthentication` and only used for `\TYPO3\CMS\Core\Authentication\BackendUserAuthentication::jsConfirmation()`, so what about putting this class into `\TYPO3\CMS\Core\Authentication`?
  6. Benni Mack commented on patch set 9 07/21/23, 13:54

    JsConfirmation.php:18 Reply

    Agreed!
  7. Alexander Schnitzler commented on patch set 9 07/21/23, 14:57

    BackendUserAuthentication.php:1000

    I'm sorry but this somehow contradicts the idea of the bitset class which already implements all methods needed to check for bits on the set. What I would do here is this and drop all methods of the class: ``` $alertPopupsSetting = trim((string)($this->getTSConfig()['options.']['alertPopups'] ?? '')); $alertPopupsSetting = $alertPopupsSetting === '' ? JsConfirmation::ALL : (int)$alertPopupsSetting; return (new JsConfirmation($alertPopupsSetting))->get($bitmask); ``` Unless I am wrong here, what we want to do is to create a bit set off of the typoscript setting and then check if the incoming bit is set in this bitset. Example: typoscript is set to 12 (4 and 8), then a check for bit 8 returns true here.

    JsConfirmation.php:30

    This doesn't add up. All bits set in this bitset results in 143, not 255. I'd say we either make ALL be `self::TYPE_CHANGE | self::COPY_MOVE_PASTE | self::DELETE | self::FE_EDIT | self::OTHER` or we drop it entierely because we can somehow get rid of it.
  8. Alexander Schnitzler commented on patch set 9 07/21/23, 15:01

    JsConfirmation.php:30 Reply

    Just read the documentation and now I get why we need to support 255 although bits 16,32 and 64 are not in use. https://docs.typo3.org/m/typo3/reference-tsconfig/main/en-us/UserTsconfig/Options.html#alertpopups I'd recommend adding those as private consts and have public const ALL be constructed like mentioned above with the values of those private consts: ``` private const UNUSED_16 = 0b00010000; private const UNUSED_32 = 0b00100000; private const UNUSED_64 = 0b01000000; self::TYPE_CHANGE | self::COPY_MOVE_PASTE | self::DELETE | self::FE_EDIT | self::UNUSED_16 | self::UNUSED_32 | self::UNUSED_64 | self::OTHER ```
  9. Alexander Schnitzler uploaded patch set 10 CR +1 V +1 07/22/23, 11:14

  10. Alexander Schnitzler uploaded patch set 11 07/22/23, 11:20

  11. Alexander Schnitzler commented on patch set 11 07/22/23, 11:21

    JsConfirmation.php:18 Reply

    Done
  12. core-ci voted on patch set 10 V +1 07/22/23, 11:21 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44414

  13. Alexander Schnitzler uploaded patch set 12 07/22/23, 11:24

  14. Alexander Schnitzler commented on patch set 12 07/22/23, 11:24

    Patch Set 12 is just a manual rebase.
  15. core-ci voted on patch set 11 V +1 07/22/23, 11:27 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44415

  16. core-ci voted on patch set 12 V +1 07/22/23, 11:31 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/44416

  17. Alexander Schnitzler voted on patch set 12 V +1 CR +1 07/22/23, 11:31

  18. Thomas Hohn commented on patch set 12 07/25/23, 19:19

    BackendUserAuthentication.php:1000 Reply

    I'm uncertain here - but I believe the compare method returns true iff the sets are equal
  19. Alexander Schnitzler commented on patch set 12 07/26/23, 12:43

    BackendUserAuthentication.php:1000 Reply

    But we don't compare sets. We check if a certain bit is set in the bitset i.e. the typoscript options. Example: typoscript sets 1,2 and 16 (aka 19) and we check if bit 2 is set. In this case it's true. A check for bit 4 returns false.
  20. Thomas Hohn commented on patch set 12 07/26/23, 12:50

    BackendUserAuthentication.php:1000 Reply

    You are right - must have been tired :-(
  21. Alexander Schnitzler commented on patch set 12 07/26/23, 13:14

    BackendUserAuthentication.php:1000 Reply

    No problem, you're welcome :) I am glad this could be resolved. If there are questions left, feel free to open a new thread.
  22. Alexander Schnitzler commented on patch set 12 07/26/23, 13:15

    JsConfirmation.php:30 Reply

    Done
  23. Oliver Klee voted on patch set 12 CR +1 07/27/23, 14:00

  24. Benni Mack voted on patch set 12 V +2 CR +2 08/01/23, 11:38

  25. Benni Mack merged patch set 13 08/01/23, 11:38