Don't let a discussion have an empty slug as it messes with the router

This commit is contained in:
Toby Zerner 2015-05-07 16:53:57 +09:30
parent d7667fdea6
commit 25f399ca35

View File

@ -18,7 +18,7 @@ class Discussion extends Model {
Discussion.prototype.id = Model.prop('id'); Discussion.prototype.id = Model.prop('id');
Discussion.prototype.title = Model.prop('title'); 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.startTime = Model.prop('startTime', Model.date);
Discussion.prototype.startUser = Model.one('startUser'); Discussion.prototype.startUser = Model.one('startUser');