FIX: ensures raw is correctly cleared when values are empty

FIX: ensures raw is correctly cleared when values are empty

diff --git a/app/models/discourse_post_event/event.rb b/app/models/discourse_post_event/event.rb
index e6c148d..629880a 100644
--- a/app/models/discourse_post_event/event.rb
+++ b/app/models/discourse_post_event/event.rb
@@ -188,9 +188,9 @@ module DiscoursePostEvent
         event = post.event || DiscoursePostEvent::Event.new(id: post.id)
 
         params = {
-          name: event_params[:name] || event.name,
+          name: event_params[:name],
           starts_at: event_params[:start] || event.starts_at,
-          ends_at: event_params[:end] || event.ends_at,
+          ends_at: event_params[:end],
           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
         }
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 65259f8..daa31c5 100644
--- a/assets/javascripts/discourse/controllers/discourse-post-event-builder.js.es6
+++ b/assets/javascripts/discourse/controllers/discourse-post-event-builder.js.es6
@@ -100,7 +100,8 @@ export default Controller.extend(ModalFunctionality, {
     const eventParams = this._buildEventParams();
     const markdownParams = [];
     Object.keys(eventParams).forEach(key => {
-      markdownParams.push(`${key}="${eventParams[key]}"`);
+      let value = eventParams[key];
+      markdownParams.push(`${key}="${value}"`);
     });
 
     this.toolbarEvent.addText(
@@ -144,6 +145,8 @@ export default Controller.extend(ModalFunctionality, {
 
     if (this.model.eventModel.name) {
       eventParams.name = this.model.eventModel.name;
+    } else {
+      eventParams.name = "";
     }
 
     if (this.endsAt) {

GitHub sha: 3967dbf8