Skip to content
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

Merged
merged 4 commits into from Feb 10, 2018
Merged

transloadit: Easily pass form fields #593

merged 4 commits into from Feb 10, 2018

Conversation

goto-bus-stop
Copy link
Contributor

Set fields: true to send along fields 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

@goto-bus-stop goto-bus-stop mentioned this pull request Feb 5, 2018
11 tasks
return Promise.all(
fileIDs.map((fileID) => {
const file = this.uppy.getFile(fileID)
const promise = Promise.resolve()
.then(() => options.getAssemblyOptions(file, options))
.then(normalizeAssemblyOptions)
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, ok, makes sense.

@goto-bus-stop
Copy link
Contributor Author

Going to switch this to an array of field names instead so we avoid the global vs file-specific metadata weirdness.

@arturi
Copy link
Contributor

arturi commented Feb 9, 2018

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.

?

@goto-bus-stop
Copy link
Contributor Author

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

@arturi
Copy link
Contributor

arturi commented Feb 9, 2018

So if there are matching fields with different values across files, the value will be overwritten each time?

@goto-bus-stop
Copy link
Contributor Author

Those files will end up in different assemblies each

@arturi arturi merged commit 08505b7 into master Feb 10, 2018
@arturi
Copy link
Contributor

arturi commented Feb 10, 2018

All right, thanks!

@arturi arturi deleted the feature/tl-global-meta branch February 10, 2018 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants