mirror of
https://github.com/discourse/discourse.git
synced 2024-11-30 12:43:54 -06:00
FIX: No JIT when quoting a mention (#12835)
This commit is contained in:
parent
3b2f2b533f
commit
2c4fd7f7c7
@ -540,6 +540,10 @@ export default Component.extend({
|
||||
schedule("afterRender", () => {
|
||||
let found = this.warnedGroupMentions || [];
|
||||
$preview.find(".mention-group.notify").each((idx, e) => {
|
||||
if (this._isInQuote(e)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const $e = $(e);
|
||||
let name = $e.data("name");
|
||||
if (found.indexOf(name) === -1) {
|
||||
@ -860,6 +864,30 @@ export default Component.extend({
|
||||
this.send("togglePreview");
|
||||
},
|
||||
|
||||
_isInQuote(element) {
|
||||
let parent = element.parentElement;
|
||||
while (parent && !this._isPreviewRoot(parent)) {
|
||||
if (this._isQuote(parent)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
parent = parent.parentElement;
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
_isPreviewRoot(element) {
|
||||
return (
|
||||
element.tagName === "DIV" &&
|
||||
element.classList.contains("d-editor-preview")
|
||||
);
|
||||
},
|
||||
|
||||
_isQuote(element) {
|
||||
return element.tagName === "ASIDE" && element.classList.contains("quote");
|
||||
},
|
||||
|
||||
actions: {
|
||||
importQuote(toolbarEvent) {
|
||||
this.importQuote(toolbarEvent);
|
||||
|
@ -29,6 +29,15 @@ acceptance("Composer", function (needs) {
|
||||
server.get("/posts/419", () => {
|
||||
return helper.response({ id: 419 });
|
||||
});
|
||||
server.get("/u/is_local_username", () => {
|
||||
return helper.response({
|
||||
valid: [],
|
||||
valid_groups: ["staff"],
|
||||
mentionable_groups: [{ name: "staff", user_count: 30 }],
|
||||
cannot_see: [],
|
||||
max_users_notified_per_group_mention: 100,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
skip("Tests the Composer controls", async function (assert) {
|
||||
@ -1007,4 +1016,18 @@ acceptance("Composer", function (needs) {
|
||||
await fillIn(".d-editor-input", "[](https://github.com)");
|
||||
assert.equal(find(".composer-popup").length, 1);
|
||||
});
|
||||
|
||||
test("Shows the 'group_mentioned' notice", async function (assert) {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("#topic-footer-buttons .create");
|
||||
|
||||
await fillIn(".d-editor-input", "[quote]\n@staff\n[/quote]");
|
||||
assert.notOk(
|
||||
exists(".composer-popup"),
|
||||
"Doesn't show the 'group_mentioned' notice in a quote"
|
||||
);
|
||||
|
||||
await fillIn(".d-editor-input", "@staff");
|
||||
assert.ok(exists(".composer-popup"), "Shows the 'group_mentioned' notice");
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user