68522[BUGFIX] Exclude language "All" from available translation source languages
Commit message
Review
-
Code review CR +2 Done
- Christian Kuhn +2
- Oli Bartsch +1
- Benni Mack +1
-
Verified V +2 Done
- Christian Kuhn +2
- Oli Bartsch +1
- Benni Mack +1
- TYPO3com +1 CI
- core-ci +1 CI
Issues 1
Files 1
Review log 915
-
Dmitry Dulepov uploaded patch set 1 03/20/21, 17:41
-
TYPO3com voted on patch set 1 V -1 03/20/21, 17:42 Completed build in 37s on Sat, 20 Mar, 05:42 PM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-10250
-
core-ci voted on patch set 1 V -1 03/20/21, 17:43 Core CI is not happy: https://core.b13.com/typo3-core/typo3.cms/-/pipelines/1711
-
Dmitry Dulepov uploaded patch set 2 03/20/21, 17:44
-
Dmitry Dulepov uploaded patch set 3 03/20/21, 17:44
-
TYPO3com commented on patch set 2 03/20/21, 17:45 Completed build in 01m 04s on Sat, 20 Mar, 05:45 PM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-10251
-
core-ci commented on patch set 2 03/20/21, 17:48 Core CI is not happy: https://core.b13.com/typo3-core/typo3.cms/-/pipelines/1712
-
TYPO3com voted on patch set 3 V +1 03/20/21, 17:52 Completed build in 08m 08s on Sat, 20 Mar, 05:52 PM Test Summary: 32907 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-10252
-
core-ci voted on patch set 3 V +1 03/20/21, 17:54 Core CI is happy: https://core.b13.com/typo3-core/typo3.cms/-/pipelines/1713
-
Benni Mack voted on patch set 3 V +1 CR +1 03/22/21, 19:40
-
Oli Bartsch commented on patch set 3 03/22/21, 20:15
-
Dmitry Dulepov commented on patch set 3 03/23/21, 04:36
LocalizationController.php:106ReplyThank you for your question and attention to details. I considered adding another condition there but decided against it for several reasons. Firsts, this whole issue did not exist before "fetchAvailableLanguages" was adjusted to return -1. That addition was okay for other places of the system, but this particular place did not expect it because it never happened before. So there was an assumption that "fetchAvailableLanguages" will never return -1. This violates a black box principle for the API functions. The outer code should not make too many assumptions but sanitize any received data. Kind of defensive programming. Now, as you see, there is "if" and "else". "Else" statement currently cannot return -1 but "if" did not return it before either. My code ensures that if "else" ever gets a "-1" language, it will be also removed. So my code automatically protects from future modifications of other API functions too. Secondly, it is about readability. The more conditions are added into "if", the bulkier, messier and harder to read it becomes. TYPO3 is complex enough and I contributed quite a lot to this complexity in the past. In such cases it is usually recommended to use functions with clear names inside conditions (like `isInSystemLanguages(...) && !isDefaultLanguage(...)`). While that makes the condition more readable and less messy, it does not make it less bulky, so it is still harder to understand. I would prefer to make multiple conditions that are clearer and easier to read and understand by humans. Wouldn't you agree that my new code block clearly shows that -1 is removed and why? So anybody can understand why this code is there and how it works in a second. Basically ti separates various logic block for better readability. I want future proof code that is also easy to read & understand. -
Oli Bartsch commented on patch set 3 V +1 CR +1 03/23/21, 10:08
LocalizationController.php:106ReplyHi, I'm not sure what you mean by "That addition was okay for other places of the system". Since this method is AFAICS only used once in the LocalizationController, it's not really a API function but specific to this controller. Actually the whole LocalizationRepository is only used by the LocalizationController and since #84877 also declared as internal. However, I got your point. I was just wondering since array_filter is really time consuming. So I wanted to make sure that the already existing if clause was not just missed but left out on purpose. -
Christian Kuhn voted on patch set 3 V +2 CR +2 03/26/21, 10:14
-
Christian Kuhn merged patch set 4 03/26/21, 10:14
LocalizationController.php:106