Skip to content

Commit

Permalink
feat: save user's locale on form submit
Browse files Browse the repository at this point in the history
  • Loading branch information
adrians5j committed Aug 1, 2019
1 parent f130932 commit 293bdaa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/webiny-api-forms/src/entities/Form.entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { getPlugins } from "webiny-plugins";
import { pick } from "lodash";
import { createFieldModel, createSettingsModel, FormStatsModel } from "./Form";
import got from "got";
import FormData from "form-data";

export default (context: Object) => {
const { getUser, getEntities } = context;
Expand Down Expand Up @@ -286,9 +285,11 @@ export default (context: Object) => {
}

// Validation passed, let's create a form submission.
const { i18n } = context;

const formSubmission = new FormSubmission();
formSubmission.data = data;
formSubmission.meta = meta;
formSubmission.meta = { ...meta, locale: i18n.getLocale().id };

formSubmission.form = {
parent: this.parent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ class MetaModel extends Model {
this.attr("ip")
.char()
.setValidators("required");
this.attr("locale")
.char()
.setValidators("required");
this.attr("submittedOn")
.date()
.setValidators("required")
Expand Down

0 comments on commit 293bdaa

Please sign in to comment.