FIX: Replying to OP is a reply to the topic, not the post (#23380)

Clicking on the OP's Reply button twice results in the post being a reply to post number 1. This is a fix for that.
This commit is contained in:
Natalie Tay 2023-09-04 17:06:41 +08:00 committed by GitHub
parent 7ea3079e3e
commit 187f9a9495
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 1 deletions

View File

@ -657,7 +657,8 @@ export default Controller.extend(bufferedProperty("model"), {
if (
composerController.get("model.topic.id") === topic.get("id") &&
composerController.get("model.action") === Composer.REPLY
composerController.get("model.action") === Composer.REPLY &&
post?.get("post_number") !== 1
) {
composerController.set("model.post", post);
composerController.set("model.composeState", Composer.OPEN);

View File

@ -334,6 +334,22 @@ acceptance("Composer", function (needs) {
);
});
test("Replying to the first post in a topic is a topic reply", async function (assert) {
await visit("/t/internationalization-localization/280");
await click("#post_1 .reply.create");
assert.strictEqual(
query(".reply-details a.topic-link").innerText,
"Internationalization / localization"
);
await click("#post_1 .reply.create");
assert.strictEqual(
query(".reply-details a.topic-link").innerText,
"Internationalization / localization"
);
});
test("Can edit a post after starting a reply", async function (assert) {
await visit("/t/internationalization-localization/280");