FIX: inaccurate tracking of current topic

Under some cases we would trigger the "you are replying on a different
topic" when in fact, your were not
This commit is contained in:
Sam 2018-07-17 17:24:11 +10:00
parent fe230f29cd
commit 9f1e8d4f58
2 changed files with 22 additions and 19 deletions

View File

@ -533,10 +533,13 @@ export default Ember.Controller.extend({
// if we are replying to a topic AND not on the topic pop the window up
if (!force && composer.get("replyingToTopic")) {
const currentTopic = this.get("topicModel");
if (
!currentTopic ||
currentTopic.get("id") !== composer.get("topic.id")
) {
if (!currentTopic) {
this.save(true);
return;
}
if (currentTopic.get("id") !== composer.get("topic.id")) {
const message = I18n.t("composer.posting_not_on_topic");
let buttons = [
@ -547,21 +550,19 @@ export default Ember.Controller.extend({
}
];
if (currentTopic) {
buttons.push({
label:
I18n.t("composer.reply_here") +
"<br/><div class='topic-title overflow-ellipsis'>" +
currentTopic.get("fancyTitle") +
"</div>",
class: "btn btn-reply-here",
callback: () => {
composer.set("topic", currentTopic);
composer.set("post", null);
this.save(true);
}
});
}
buttons.push({
label:
I18n.t("composer.reply_here") +
"<br/><div class='topic-title overflow-ellipsis'>" +
currentTopic.get("fancyTitle") +
"</div>",
class: "btn btn-reply-here",
callback: () => {
composer.set("topic", currentTopic);
composer.set("post", null);
this.save(true);
}
});
buttons.push({
label:

View File

@ -248,6 +248,8 @@ const TopicRoute = Discourse.Route.extend({
this.screenTrack.stop();
this.appEvents.trigger("header:hide-topic");
this.controllerFor("topic").set("model", null);
},
setupController(controller, model) {