FIX: prevents wizard to generate an `undefined` name

FIX: prevents wizard to generate an undefined name

diff --git a/app/models/discourse_post_event/event.rb b/app/models/discourse_post_event/event.rb
index 9953c1b..35df083 100644
--- a/app/models/discourse_post_event/event.rb
+++ b/app/models/discourse_post_event/event.rb
@@ -179,7 +179,9 @@ module DiscoursePostEvent
 
       if events.present?
         event_params = events.first
-        event = post.event || Event.new(id: post.id)
+
+        event = post.event || DiscoursePostEvent::Event.new(id: post.id)
+
         params = {
           name: event_params[:name] || event.name,
           starts_at: event_params[:start] || event.starts_at,
@@ -187,6 +189,7 @@ module DiscoursePostEvent
           status: event_params[:status].present? ? Event.statuses[event_params[:status].to_sym] : event.status,
           raw_invitees: event_params[:"allowed-groups"] ? event_params[:"allowed-groups"].split(',') : nil
         }
+
         event.enforce_utc!(params)
         event.update_with_params!(params)
       elsif post.event
diff --git a/assets/javascripts/discourse/controllers/discourse-post-event-builder.js.es6 b/assets/javascripts/discourse/controllers/discourse-post-event-builder.js.es6
index 43643bf..e91bddc 100644
--- a/assets/javascripts/discourse/controllers/discourse-post-event-builder.js.es6
+++ b/assets/javascripts/discourse/controllers/discourse-post-event-builder.js.es6
@@ -135,11 +135,17 @@ export default Controller.extend(ModalFunctionality, {
 
   _buildEventParams() {
     const eventParams = {
-      start: this.startsAt,
-      status: this.model.eventModel.status,
-      name: this.model.eventModel.name
+      start: this.startsAt
     };
 
+    if (this.model.eventModel.status) {
+      eventParams.status = this.model.eventModel.status;
+    }
+
+    if (this.model.eventModel.name) {
+      eventParams.name = this.model.eventModel.name;
+    }
+
     if (this.endsAt) {
       eventParams.end = this.endsAt;
     }

GitHub sha: c7cdeff4