-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix default value in extended Metadata #812
base: main
Are you sure you want to change the base?
Fix default value in extended Metadata #812
Conversation
The default value for metadata fields in the extended metadata tab was always `false` instead of the intended default value (usually `""`). This patch fixes that.
This pull request is deployed at test.admin-interface.opencast.org/812/2024-07-04_08-13-29/ . |
Use Run test server using develop.opencast.org as backend:
Specify a different backend like stable.opencast.org:
It may take a few seconds for the interface to spin up. |
@@ -125,7 +125,7 @@ export const getInitialMetadataFieldValues = ( | |||
for (const metadataCatalog of extendedMetadata) { | |||
if (!!metadataCatalog.fields && metadataCatalog.fields.length > 0) { | |||
metadataCatalog.fields.forEach((field) => { | |||
let value = false; | |||
let value: string | string[] | boolean = field.value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still doesn't seem correct to me. According to the docs, you can configure the type of each field (boolean
, text
, …). This would convert a field of type text
with the value false
to a boolean, wouldn't it? At the same time, types like date
are kept as string. That seems weird. But maybe I'm missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly, I don't quite get it either. I only tried to fix the issue I introduced myself here, so I mainly just put the code back "as it was". Why we would need to convert strings to booleans, and not other types like dates, and only for the extended metadata is beyond me. On the other hand, the conversion-to-boolean code currently never runs anyway, as we don't accept default values for metadata fields in the first place. So maybe it is better to remove the code entirely and have it behave more like the code for the main metadata catalog?
The default value for metadata fields in the extended metadata tab was always
false
instead of the intended default value (usually""
). This patch fixes that.