78188[!!!][TASK] Convert JsConfirmation to BitSet
Commit message
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
- typo3/sysext/backend/Classes/Clipboard/Clipboard.php+1 −1
- typo3/sysext/backend/Classes/ContextMenu/ItemProviders/RecordProvider.php+1 −1
- typo3/sysext/backend/Classes/Controller/Page/TreeController.php+1 −1
- typo3/sysext/backend/Classes/Form/Container/FlexFormElementContainer.php+1 −1
- typo3/sysext/backend/Classes/Form/Container/SingleFieldContainer.php+1 −1
- typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php5+8 −11
- typo3/sysext/core/Classes/Authentication/JsConfirmation.phpnew+38 −0
- typo3/sysext/core/Classes/Type/Bitmask/JsConfirmation.php11deleted+0 −113
- typo3/sysext/core/Documentation/Changelog/13.0/Breaking-100229-ConvertJSConfirmationToBitSet.rst7new+60 −0
- typo3/sysext/core/Tests/Unit/Authentication/BackendUserAuthenticationTest.php+1 −1
- typo3/sysext/filelist/Classes/ContextMenu/ItemProviders/FileProvider.php+1 −1
- typo3/sysext/filelist/Classes/FileList.php+1 −1
Review log 4355
Show 2330 earlier messages
-
Thomas Hohn uploaded patch set 1 03/20/23, 20:24
-
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
-
Georg Ringer commented on patch set 1 03/20/23, 20:53
-
Thomas Hohn uploaded patch set 2
V -103/21/23, 04:55 -
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
-
Alexander Schnitzler commented on patch set 2 03/21/23, 06:20
JsConfirmation.php:24Not 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. -
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. -
Thomas Hohn commented on patch set 2 03/23/23, 04:40
Reply
Will postpone it to V13 then -
Alexander Schnitzler wrote 04/01/23, 17:17
Removed cc Alexander Schnitzler. -
Thomas Hohn uploaded patch set 3
CR -1V +106/21/23, 07:54 -
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
-
Thomas Hohn uploaded patch set 4
V +106/23/23, 07:01 -
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
-
Thomas Hohn uploaded patch set 5
V +106/23/23, 07:11 -
Thomas Hohn commented on patch set 5 06/23/23, 07:12
JsConfirmation.php:24ReplyAdded breaking rstJsConfirmation.php:24ReplyDone -
Thomas Hohn commented on patch set 5 06/23/23, 07:12
Reply
Added rst -
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
-
Thomas Hohn commented on patch set 5 06/23/23, 20:26
JsConfirmation.php:24ReplyDone -
Benni Mack commented on patch set 5 07/04/23, 20:05
Breaking-100229-ConvertJSConfirmationToBitSet.rst:22I do not understand this sentence - what is the impact? -
Thomas Hohn commented on patch set 5 07/04/23, 20:50
Breaking-100229-ConvertJSConfirmationToBitSet.rst:22ReplyI 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 :) -
Thomas Hohn uploaded patch set 6
V +107/05/23, 04:55 -
Thomas Hohn commented on patch set 6 07/05/23, 04:56
Breaking-100229-ConvertJSConfirmationToBitSet.rst:22ReplyHope it's clearer now -
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
-
Oliver Klee commented on patch set 6 07/05/23, 08:30
Breaking-100229-ConvertJSConfirmationToBitSet.rst:22ReplyI'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? -
Thomas Hohn commented on patch set 6 07/05/23, 08:40
Breaking-100229-ConvertJSConfirmationToBitSet.rst:22ReplyNo - the other way around. It's no longer possible to call any of the old methods except for the compare method :-) -
Thomas Hohn uploaded patch set 7
V +107/06/23, 04:50 -
Thomas Hohn commented on patch set 7 07/06/23, 04:51
Breaking-100229-ConvertJSConfirmationToBitSet.rst:22ReplyDid a second attempt -
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
-
Thomas Hohn commented on patch set 7 07/06/23, 13:34
Breaking-100229-ConvertJSConfirmationToBitSet.rst:22ReplyDone -
Thomas Hohn rebased onto patch set 8
V +107/06/23, 13:34
-
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
-
Oliver Klee commented on patch set 9
V +107/15/23, 11:34Published edit on patch set 8. -
Oliver Klee voted on patch set 9 CR +1 07/15/23, 11:34
-
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
-
Alexander Schnitzler commented on patch set 9 CR -1 07/21/23, 13:16
JsConfirmation.php:18Don'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`? -
Benni Mack commented on patch set 9 07/21/23, 13:54
JsConfirmation.php:18ReplyAgreed! -
Alexander Schnitzler commented on patch set 9 07/21/23, 14:57
BackendUserAuthentication.php:1000I'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:30This 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. -
Alexander Schnitzler commented on patch set 9 07/21/23, 15:01
JsConfirmation.php:30ReplyJust 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 ``` -
Alexander Schnitzler uploaded patch set 10
CR +1V +107/22/23, 11:14 -
Alexander Schnitzler uploaded patch set 11 07/22/23, 11:20
-
Alexander Schnitzler commented on patch set 11 07/22/23, 11:21
JsConfirmation.php:18ReplyDone -
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
-
Alexander Schnitzler uploaded patch set 12 07/22/23, 11:24
-
Alexander Schnitzler commented on patch set 12 07/22/23, 11:24
Patch Set 12 is just a manual rebase. -
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
-
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
-
Alexander Schnitzler voted on patch set 12 V +1 CR +1 07/22/23, 11:31
-
Thomas Hohn commented on patch set 12 07/25/23, 19:19
BackendUserAuthentication.php:1000ReplyI'm uncertain here - but I believe the compare method returns true iff the sets are equal -
Alexander Schnitzler commented on patch set 12 07/26/23, 12:43
BackendUserAuthentication.php:1000ReplyBut 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. -
Thomas Hohn commented on patch set 12 07/26/23, 12:50
BackendUserAuthentication.php:1000ReplyYou are right - must have been tired :-( -
Alexander Schnitzler commented on patch set 12 07/26/23, 13:14
BackendUserAuthentication.php:1000ReplyNo problem, you're welcome :) I am glad this could be resolved. If there are questions left, feel free to open a new thread. -
Alexander Schnitzler commented on patch set 12 07/26/23, 13:15
JsConfirmation.php:30ReplyDone -
Oliver Klee voted on patch set 12 CR +1 07/27/23, 14:00
-
Benni Mack voted on patch set 12 V +2 CR +2 08/01/23, 11:38
-
Benni Mack merged patch set 13 08/01/23, 11:38
JsConfirmation.php:24