FIX: Updating custom fields with new value (#495)

We were incorrectly access the input value from `setCustomField`. Additionally, we can only call `.set` on a `EmberObject`, which we were initializing the `custom_fields` with a empty hash (`{}`) causing the `set` call to fail.
This commit is contained in:
Isaac Janzen 2023-12-07 15:36:02 -07:00 committed by GitHub
parent 1c5beb4432
commit 68a62b1265
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -73,8 +73,8 @@ export default class PostEventBuilder extends Component {
}
@action
setCustomField(field, target) {
this.args.model.updateCustomField(field, target.value);
setCustomField(field, e) {
this.args.model.updateCustomField(field, e.target.value);
}
@action

View File

@ -1,3 +1,4 @@
import EmberObject from "@ember/object";
import { withPluginApi } from "discourse/lib/plugin-api";
import PostEventBuilder from "../components/modal/post-event-builder";
import {
@ -20,7 +21,7 @@ function initializeEventBuilder(api) {
const eventModel = store.createRecord("discourse-post-event-event");
eventModel.setProperties({
status: "public",
custom_fields: {},
custom_fields: EmberObject.create({}),
starts_at: moment(),
timezone: moment.tz.guess(),
});