mirror of
https://github.com/discourse/discourse.git
synced 2025-03-31 22:16:27 +08:00
FIX: Modal asking where to post was missing
This commit is contained in:
parent
4451c8802a
commit
8e395a94d4
app/assets/javascripts/discourse
test/javascripts
@ -191,8 +191,9 @@ export default Ember.ObjectController.extend(Presence, {
|
|||||||
// for now handle a very narrow use case
|
// for now handle a very narrow use case
|
||||||
// if we are replying to a topic AND not on the topic pop the window up
|
// if we are replying to a topic AND not on the topic pop the window up
|
||||||
if (!force && composer.get('replyingToTopic')) {
|
if (!force && composer.get('replyingToTopic')) {
|
||||||
const topic = this.get('model.topic');
|
|
||||||
if (!topic || topic.get('id') !== composer.get('topic.id'))
|
const currentTopic = this.get('controllers.topic.model');
|
||||||
|
if (!currentTopic || currentTopic.get('id') !== composer.get('topic.id'))
|
||||||
{
|
{
|
||||||
const message = I18n.t("composer.posting_not_on_topic");
|
const message = I18n.t("composer.posting_not_on_topic");
|
||||||
|
|
||||||
@ -202,12 +203,12 @@ export default Ember.ObjectController.extend(Presence, {
|
|||||||
"link": true
|
"link": true
|
||||||
}];
|
}];
|
||||||
|
|
||||||
if (topic) {
|
if (currentTopic) {
|
||||||
buttons.push({
|
buttons.push({
|
||||||
"label": I18n.t("composer.reply_here") + "<br/><div class='topic-title overflow-ellipsis'>" + Handlebars.Utils.escapeExpression(topic.get('title')) + "</div>",
|
"label": I18n.t("composer.reply_here") + "<br/><div class='topic-title overflow-ellipsis'>" + Handlebars.Utils.escapeExpression(currentTopic.get('title')) + "</div>",
|
||||||
"class": "btn btn-reply-here",
|
"class": "btn btn-reply-here",
|
||||||
"callback": function() {
|
"callback": function() {
|
||||||
composer.set('topic', topic);
|
composer.set('topic', currentTopic);
|
||||||
composer.set('post', null);
|
composer.set('post', null);
|
||||||
self.save(true);
|
self.save(true);
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ export default ObjectController.extend(SelectedPostsCount, BufferedContent, {
|
|||||||
loadedAllPosts: false,
|
loadedAllPosts: false,
|
||||||
enteredAt: null,
|
enteredAt: null,
|
||||||
firstPostExpanded: false,
|
firstPostExpanded: false,
|
||||||
|
retrying: false,
|
||||||
|
|
||||||
maxTitleLength: Discourse.computed.setting('max_topic_title_length'),
|
maxTitleLength: Discourse.computed.setting('max_topic_title_length'),
|
||||||
|
|
||||||
|
@ -128,8 +128,8 @@
|
|||||||
{{{model.notFoundHtml}}}
|
{{{model.notFoundHtml}}}
|
||||||
{{else}}
|
{{else}}
|
||||||
<div class="topic-error">
|
<div class="topic-error">
|
||||||
<div>{{message}}</div>
|
<div>{{model.message}}</div>
|
||||||
{{#if noRetry}}
|
{{#if model.noRetry}}
|
||||||
{{#unless currentUser}}
|
{{#unless currentUser}}
|
||||||
{{d-button action="showLogin" class="btn-primary topic-retry" icon="user" label="log_in"}}
|
{{d-button action="showLogin" class="btn-primary topic-retry" icon="user" label="log_in"}}
|
||||||
{{/unless}}
|
{{/unless}}
|
||||||
|
@ -119,6 +119,27 @@ test("Create a Reply", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("Posting on a different topic", (assert) => {
|
||||||
|
visit("/t/internationalization-localization/280");
|
||||||
|
click('#topic-footer-buttons .btn.create');
|
||||||
|
fillIn('#wmd-input', 'this is the content for a different topic');
|
||||||
|
|
||||||
|
visit("/t/1-3-0beta9-no-rate-limit-popups/28830");
|
||||||
|
andThen(function() {
|
||||||
|
assert.equal(currentURL(), "/t/1-3-0beta9-no-rate-limit-popups/28830");
|
||||||
|
});
|
||||||
|
click('#reply-control button.create');
|
||||||
|
andThen(function() {
|
||||||
|
assert.ok(visible('.reply-where-modal'), 'it pops up a modal');
|
||||||
|
});
|
||||||
|
|
||||||
|
click('.btn-reply-here');
|
||||||
|
andThen(() => {
|
||||||
|
assert.equal(find('.cooked:last p').text(), 'this is the content for a different topic');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
test("Create an enqueued Reply", () => {
|
test("Create an enqueued Reply", () => {
|
||||||
visit("/t/internationalization-localization/280");
|
visit("/t/internationalization-localization/280");
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
@ -103,6 +103,10 @@ export default function() {
|
|||||||
return response(fixturesByUrl['/t/280/1.json']);
|
return response(fixturesByUrl['/t/280/1.json']);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.get("/t/28830.json", function() {
|
||||||
|
return response(fixturesByUrl['/t/28830/1.json']);
|
||||||
|
});
|
||||||
|
|
||||||
this.get("/t/id_for/:slug", function() {
|
this.get("/t/id_for/:slug", function() {
|
||||||
return response({id: 280, slug: "internationalization-localization", url: "/t/internationalization-localization/280"});
|
return response({id: 280, slug: "internationalization-localization", url: "/t/internationalization-localization/280"});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user