From 30cfa33629e4d72883f3e9810751e80ce00b80da Mon Sep 17 00:00:00 2001
From: Robin Ward
Date: Wed, 21 Aug 2013 16:10:16 -0400
Subject: [PATCH] FIX: @mentions within simple quotes
---
.../javascripts/discourse/dialects/mention_dialect.js | 3 ++-
test/javascripts/components/markdown_test.js | 8 ++++++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/app/assets/javascripts/discourse/dialects/mention_dialect.js b/app/assets/javascripts/discourse/dialects/mention_dialect.js
index d7a7cc39797..b90b835ad57 100644
--- a/app/assets/javascripts/discourse/dialects/mention_dialect.js
+++ b/app/assets/javascripts/discourse/dialects/mention_dialect.js
@@ -28,6 +28,7 @@ Discourse.Dialect.on("register", function(event) {
mentionLookup = dialect.options.mentionLookup || Discourse.Mention.lookupCache;
if (block.match(/^ {3}/)) { return; }
+ if (block.match(/^\>/)) { return; }
var pushIt = function(p) { result.push(p) };
@@ -53,6 +54,7 @@ Discourse.Dialect.on("register", function(event) {
if (remaining && remaining.match(/\n/)) {
next.unshift(MD.mk_block(remaining));
+ return [result];
}
}
@@ -60,7 +62,6 @@ Discourse.Dialect.on("register", function(event) {
if (remaining.length) {
this.processInline(remaining).forEach(pushIt);
}
-
return [result];
}
};
diff --git a/test/javascripts/components/markdown_test.js b/test/javascripts/components/markdown_test.js
index ff3683ea2f0..ff7fb0d586e 100644
--- a/test/javascripts/components/markdown_test.js
+++ b/test/javascripts/components/markdown_test.js
@@ -112,6 +112,14 @@ test("Mentions", function() {
"deals correctly with multiple blocks");
cooked("```\na @test\n```", "a @test
", "should not do mentions within a code block.");
+ cooked("> foo bar baz @eviltrout",
+ "foo bar baz @eviltrout
",
+ "handles mentions in simple quotes");
+
+ cooked("> foo bar baz @eviltrout ohmagerd\nlook at this",
+ "foo bar baz @eviltrout
ohmagerd\nlook at this
",
+ "does mentions properly with trailing text within a simple quote");
+
});
test("Oneboxing", function() {