mirror of
https://github.com/discourse/discourse.git
synced 2026-08-26 21:27:16 -05:00
FIX: Can edit 1st posts that have no categories
This commit is contained in:
@@ -392,13 +392,18 @@ Discourse.Composer = Discourse.Model.extend({
|
|||||||
// Update the title if we've changed it
|
// Update the title if we've changed it
|
||||||
if (this.get('title') && post.get('post_number') === 1) {
|
if (this.get('title') && post.get('post_number') === 1) {
|
||||||
var topic = this.get('topic');
|
var topic = this.get('topic');
|
||||||
var category = Discourse.Category.list().findProperty('name', this.get('categoryName'));
|
|
||||||
topic.setProperties({
|
topic.setProperties({
|
||||||
title: this.get('title'),
|
title: this.get('title'),
|
||||||
fancy_title: this.get('title'),
|
fancy_title: this.get('title')
|
||||||
categoryName: category.get('name'),
|
|
||||||
category_id: category.get('id')
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
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();
|
topic.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user