fix: default labels with SettingDropdown
and SelectDropdown
#3854
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes proposed in this pull request:
I've removed the array check that was reverted to in fix: empty string displayed as SelectDropdown title #3773. The code
if (Array.isArray(label)) label = label[0];
is from 2015. I don't think either that orextractText
is needed here -- I tested this inv1
first with no issues in the same examples provided in that PR.https://github.com/flarum/framework/blame/f7dd609b264d4266151efa3b8a4c5775526346fc/framework/core/js/src/common/components/SelectDropdown.js#L48
![image](https://private-user-images.githubusercontent.com/6401250/253339469-0efb838b-2e90-409a-92ac-36c94cb5d7de.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwMjEwNTcsIm5iZiI6MTczOTAyMDc1NywicGF0aCI6Ii82NDAxMjUwLzI1MzMzOTQ2OS0wZWZiODM4Yi0yZTkwLTQwOWEtOTJhYy0zNmM5NGNiNWQ3ZGUucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIwOCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMDhUMTMxOTE3WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZTJmOWE1OTc2YTBlYzg1N2FlZDZjYmE3ZGRhMjM5ZGJlYTkxZjM1NTZiOGY2YjdmZDE1ZjZkYTRlOTkzZTMzZCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.gA0VauD3JCVgLP0vMN8G4VsAzAS1S8VEdU59oq9eZ2A)
Made the
defaultLabel
not override custom ones set by vnode attrs. This fixes the fallbacks in PermissionGrid for eg. discussion & tag renaming. They're currently broken in v1 as well.The previous change was needed because otherwise it'd only show "For" (since
trans
returns an array). Mithril can handle arrays just fine - thelabel[0]
looks to me to be from when Mithril perhaps would join with commas (I vaguely remember that?)Also translated the "Custom" fallback. Wasn't sure what key to give the translation, since
SettingDropdown
is only used inPermissionGrid
(but technically could be used anywhere in admin, I believe).Screenshot
QA
Necessity
Confirmed
Backend changes: tests are green (runcomposer test
).