mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 15:54:23 +08:00
FIX: Modal asking where to post was missing
This commit is contained in:
parent
4451c8802a
commit
8e395a94d4
|
@ -191,8 +191,9 @@ export default Ember.ObjectController.extend(Presence, {
|
|||
// 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 (!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");
|
||||
|
||||
|
@ -202,12 +203,12 @@ export default Ember.ObjectController.extend(Presence, {
|
|||
"link": true
|
||||
}];
|
||||
|
||||
if (topic) {
|
||||
if (currentTopic) {
|
||||
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",
|
||||
"callback": function() {
|
||||
composer.set('topic', topic);
|
||||
composer.set('topic', currentTopic);
|
||||
composer.set('post', null);
|
||||
self.save(true);
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ export default ObjectController.extend(SelectedPostsCount, BufferedContent, {
|
|||
loadedAllPosts: false,
|
||||
enteredAt: null,
|
||||
firstPostExpanded: false,
|
||||
retrying: false,
|
||||
|
||||
maxTitleLength: Discourse.computed.setting('max_topic_title_length'),
|
||||
|
||||
|
|
|
@ -128,8 +128,8 @@
|
|||
{{{model.notFoundHtml}}}
|
||||
{{else}}
|
||||
<div class="topic-error">
|
||||
<div>{{message}}</div>
|
||||
{{#if noRetry}}
|
||||
<div>{{model.message}}</div>
|
||||
{{#if model.noRetry}}
|
||||
{{#unless currentUser}}
|
||||
{{d-button action="showLogin" class="btn-primary topic-retry" icon="user" label="log_in"}}
|
||||
{{/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", () => {
|
||||
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']);
|
||||
});
|
||||
|
||||
this.get("/t/28830.json", function() {
|
||||
return response(fixturesByUrl['/t/28830/1.json']);
|
||||
});
|
||||
|
||||
this.get("/t/id_for/:slug", function() {
|
||||
return response({id: 280, slug: "internationalization-localization", url: "/t/internationalization-localization/280"});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user