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
transloadit: Easily pass form fields #593
Conversation
src/plugins/Transloadit/index.js
Outdated
return Promise.all( | ||
fileIDs.map((fileID) => { | ||
const file = this.uppy.getFile(fileID) | ||
const promise = Promise.resolve() | ||
.then(() => options.getAssemblyOptions(file, options)) | ||
.then(normalizeAssemblyOptions) |
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.
Nitpicking here: is normalizeAssemblyOptions
a good name when it mostly adds fields
to an assembly?
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.
My thinking was that the fact that it mostly does fields is an implementation detail: this function takes user provided options that may use shorthands etc. and returns options in a normalized single format for the plugin.
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.
Yeah, ok, makes sense.
Going to switch this to an array of field names instead so we avoid the global vs file-specific metadata weirdness. |
So it used to work like this: if true, all global meta is passed to an assembly. Now it works like this: you pass an array of fields, and those fields will be taken from each file’s meta and passed to assembly. ? |
correct. we could also have both ways, but the array one is safer so i think it's good to force people to use it instead |
So if there are matching fields with different values across files, the value will be overwritten each time? |
Those files will end up in different assemblies each |
All right, thanks! |
Set
fields: true
to send alongfields
from global metadata when creating an assembly. This works nicely with the Form plugin, which adds form field values to the global metadata.Mimicks the jQuery SDK's
fields: true
option.I'll add docs for this in #546, to prevent merge conflicts