FIX: prefills username for new message on first post (#6305)

This commit is contained in:
Joffrey JAFFEUX 2018-08-23 11:09:35 +02:00 committed by GitHub
parent ac743dab10
commit 07e11a223c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 0 deletions

View File

@ -275,6 +275,15 @@ export default DropdownSelectBoxComponent.extend({
if (postUsername) {
usernames = postUsername;
}
} else if (this.get("composerModel.topic")) {
const stream = this.get("composerModel.topic.postStream");
if (stream.get("firstPostPresent")) {
const post = stream.get("posts.firstObject");
if (post && !post.get("yours") && post.get("username")) {
usernames = post.get("username");
}
}
}
options.action = PRIVATE_MESSAGE;

View File

@ -304,3 +304,23 @@ QUnit.test("replying to post as regular user", async assert => {
);
});
});
QUnit.test(
"replying to first post - reply_as_private_message",
async assert => {
const composerActions = selectKit(".composer-actions");
await visit("/t/internationalization-localization/280");
await click("article#post_1 button.reply");
await composerActions.expand();
await composerActions.selectRowByValue("reply_as_private_message");
assert.equal(find(".users-input .item:eq(0)").text(), "uwe_keim");
assert.ok(
find(".d-editor-input")
.val()
.indexOf("Continuing the discussion") >= 0
);
}
);