Skip to content

A platform for community discussion. Free, open, simple.

FIX: allow here as a valid mention (#34028)

David Battersby7efc992ced71
diff --git a/app/assets/javascripts/discourse/app/static/prosemirror/extensions/mention.js b/app/assets/javascripts/discourse/app/static/prosemirror/extensions/mention.js
index c141cc4fe39..83ecbc30e1a 100644
--- a/app/assets/javascripts/discourse/app/static/prosemirror/extensions/mention.js
+++ b/app/assets/javascripts/discourse/app/static/prosemirror/extensions/mention.js
@@ -107,6 +107,7 @@ const extension = {
processMentionNodes(view) {
const mentionNames = [];
const mentionNodes = [];
+ const hereMention = getContext().siteSettings.here_mention;
if (this._processingMentionNodes) {
return;
@@ -133,7 +134,7 @@ const extension = {
for (const mentionNode of mentionNodes) {
const { name, node, pos } = mentionNode;
- if (VALID_MENTIONS.has(name)) {
+ if (VALID_MENTIONS.has(name) || hereMention === name) {
continue;
}
diff --git a/app/assets/javascripts/discourse/tests/integration/components/prosemirror-editor/mention-test.js b/app/assets/javascripts/discourse/tests/integration/components/prosemirror-editor/mention-test.js
index 5a0cddd4c85..11471c20268 100644
--- a/app/assets/javascripts/discourse/tests/integration/components/prosemirror-editor/mention-test.js
+++ b/app/assets/javascripts/discourse/tests/integration/components/prosemirror-editor/mention-test.js
@@ -54,6 +54,11 @@ module(
"<p>Hello @invalid, how are you?</p>",
"Hello @invalid, how are you?",
],
+ "here mention": [
+ "Hello @here, how are you?",
+ '<p>Hello <a class="mention" data-name="here" contenteditable="false" draggable="true">@here</a>, how are you?</p>',
+ "Hello @here, how are you?",
+ ],
};
Object.entries(testCases).forEach(