mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Fix race condition when resolving tag and category hashtags (#10153)
* FIX: Fix race condition when resolving tag and category hashtags If the category hashtags were resolved first and then tag hashtags, then the tags would overwrite the categories. Similarly, if the category hashtags were resolved last it would overwrite even hashtags which ended with '::tag'. * DEV: Add test * DEV: Fix test
This commit is contained in:
@@ -13,6 +13,6 @@ QUnit.test("category hashtag is cooked properly", async assert => {
|
||||
find(".d-editor-preview:visible")
|
||||
.html()
|
||||
.trim(),
|
||||
'<p>this is a category hashtag <a href="/c/bugs" class="hashtag">#<span>bug</span></a></p>'
|
||||
'<p>this is a category hashtag <a href="/c/bugs" class="hashtag" data-type="category">#<span>bug</span></a></p>'
|
||||
);
|
||||
});
|
||||
|
||||
@@ -6,7 +6,10 @@ acceptance("Tag Hashtag", {
|
||||
pretend(server, helper) {
|
||||
server.get("/tags/check", () => {
|
||||
return helper.response({
|
||||
valid: [{ value: "monkey", url: "/tag/monkey" }]
|
||||
valid: [
|
||||
{ value: "monkey", url: "/tag/monkey" },
|
||||
{ value: "bug", url: "/tag/bug" }
|
||||
]
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -16,8 +19,7 @@ QUnit.test("tag is cooked properly", async assert => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("#topic-footer-buttons .btn.create");
|
||||
|
||||
await fillIn(".d-editor-input", "this is a tag hashtag #monkey::tag");
|
||||
// TODO: Test that the autocomplete shows
|
||||
await fillIn(".d-editor-input", "this is a tag hashtag #monkey");
|
||||
assert.equal(
|
||||
find(".d-editor-preview:visible")
|
||||
.html()
|
||||
@@ -25,3 +27,19 @@ QUnit.test("tag is cooked properly", async assert => {
|
||||
'<p>this is a tag hashtag <a href="/tag/monkey" class="hashtag">#<span>monkey</span></a></p>'
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
"tags and categories with same name are cooked properly",
|
||||
async assert => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("#topic-footer-buttons .btn.create");
|
||||
|
||||
await fillIn(".d-editor-input", "#bug vs #bug::tag");
|
||||
assert.equal(
|
||||
find(".d-editor-preview:visible")
|
||||
.html()
|
||||
.trim(),
|
||||
'<p><a href="/c/bugs" class="hashtag" data-type="category">#<span>bug</span></a> vs <a href="/tag/bug" class="hashtag" data-type="tag">#<span>bug</span></a></p>'
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user