mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 06:49:14 +08:00
FIX: Can edit 1st posts that have no categories
This commit is contained in:
parent
d4343487e6
commit
f337aea982
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user