FIX: Topic drafts weren't showing up properly.
This commit is contained in:
parent
dc77e7e27c
commit
359f03ca73
|
@ -333,14 +333,14 @@ Discourse.ComposerController = Discourse.Controller.extend({
|
||||||
cancelComposer: function() {
|
cancelComposer: function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
return Ember.Deferred.promise(function (promise) {
|
return new Ember.RSVP.Promise(function (resolve) {
|
||||||
if (self.get('model.hasMetaData') || self.get('model.replyDirty')) {
|
if (self.get('model.hasMetaData') || self.get('model.replyDirty')) {
|
||||||
bootbox.confirm(I18n.t("post.abandon"), I18n.t("no_value"), I18n.t("yes_value"), function(result) {
|
bootbox.confirm(I18n.t("post.abandon"), I18n.t("no_value"), I18n.t("yes_value"), function(result) {
|
||||||
if (result) {
|
if (result) {
|
||||||
self.destroyDraft();
|
self.destroyDraft();
|
||||||
self.get('model').clearState();
|
self.get('model').clearState();
|
||||||
self.close();
|
self.close();
|
||||||
promise.resolve();
|
resolve();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -348,7 +348,7 @@ Discourse.ComposerController = Discourse.Controller.extend({
|
||||||
self.destroyDraft();
|
self.destroyDraft();
|
||||||
self.get('model').clearState();
|
self.get('model').clearState();
|
||||||
self.close();
|
self.close();
|
||||||
promise.resolve();
|
resolve();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -31,7 +31,6 @@ Discourse.DiscoveryRoute = Discourse.Route.extend({
|
||||||
this.controllerFor('composer').open({
|
this.controllerFor('composer').open({
|
||||||
categoryId: topicsController.get('category.id'),
|
categoryId: topicsController.get('category.id'),
|
||||||
action: Discourse.Composer.CREATE_TOPIC,
|
action: Discourse.Composer.CREATE_TOPIC,
|
||||||
draft: topicsController.get('draft'),
|
|
||||||
draftKey: topicsController.get('draft_key'),
|
draftKey: topicsController.get('draft_key'),
|
||||||
draftSequence: topicsController.get('draft_sequence')
|
draftSequence: topicsController.get('draft_sequence')
|
||||||
});
|
});
|
||||||
|
|
|
@ -28,6 +28,17 @@ function buildTopicRoute(filter) {
|
||||||
Discourse.set('title', I18n.t('filters.with_topics', {filter: filterText}));
|
Discourse.set('title', I18n.t('filters.with_topics', {filter: filterText}));
|
||||||
|
|
||||||
this.controllerFor('discoveryTopics').setProperties({ model: model, category: null, period: period });
|
this.controllerFor('discoveryTopics').setProperties({ model: model, category: null, period: period });
|
||||||
|
|
||||||
|
// If there's a draft, open the create topic composer
|
||||||
|
if (model.draft) {
|
||||||
|
this.controllerFor('composer').open({
|
||||||
|
action: Discourse.Composer.CREATE_TOPIC,
|
||||||
|
draft: model.draft,
|
||||||
|
draftKey: model.draft_key,
|
||||||
|
draftSequence: model.draft_sequence
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
this.controllerFor('navigationDefault').set('canCreateTopic', model.get('can_create_topic'));
|
this.controllerFor('navigationDefault').set('canCreateTopic', model.get('can_create_topic'));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue