FIX: Can edit 1st posts that have no categories

This commit is contained in:
Robin Ward 2013-08-02 17:40:17 -04:00
parent d4343487e6
commit f337aea982

View File

@ -392,13 +392,18 @@ Discourse.Composer = Discourse.Model.extend({
// Update the title if we've changed it
if (this.get('title') && post.get('post_number') === 1) {
var topic = this.get('topic');
var category = Discourse.Category.list().findProperty('name', this.get('categoryName'));
topic.setProperties({
title: this.get('title'),
fancy_title: this.get('title'),
categoryName: category.get('name'),
category_id: category.get('id')
fancy_title: this.get('title')
});
var category = Discourse.Category.list().findProperty('name', this.get('categoryName'));
if (category) {
topic.setProperties({
categoryName: category.get('name'),
category_id: category.get('id')
});
}
topic.save();
}