From 25f399ca35313eb8625295c39860cc6364a6f4d6 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Thu, 7 May 2015 16:53:57 +0930 Subject: [PATCH] Don't let a discussion have an empty slug as it messes with the router --- framework/core/js/lib/models/discussion.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/core/js/lib/models/discussion.js b/framework/core/js/lib/models/discussion.js index 0e7be1708..9e26da2f3 100644 --- a/framework/core/js/lib/models/discussion.js +++ b/framework/core/js/lib/models/discussion.js @@ -18,7 +18,7 @@ class Discussion extends Model { Discussion.prototype.id = Model.prop('id'); Discussion.prototype.title = Model.prop('title'); -Discussion.prototype.slug = computed('title', title => title.toLowerCase().replace(/[^a-z0-9]/gi, '-').replace(/-+/g, '-').replace(/-$|^-/g, '')); +Discussion.prototype.slug = computed('title', title => title.toLowerCase().replace(/[^a-z0-9]/gi, '-').replace(/-+/g, '-').replace(/-$|^-/g, '') || '-'); Discussion.prototype.startTime = Model.prop('startTime', Model.date); Discussion.prototype.startUser = Model.one('startUser');