From 44b04e452132b3b446200aad5a94cf261b4e9d17 Mon Sep 17 00:00:00 2001 From: James D Date: Fri, 16 Oct 2015 19:17:54 -0400 Subject: [PATCH] Make @mentions following a slash link to usercards A slash preceding an @mention was causing the markup for the usercard link to not be generated. For example, the markdown Pinging @bob/@joe Would generate a usercard for @bob, but not @joe. --- app/assets/javascripts/discourse/dialects/dialect.js | 2 +- test/javascripts/lib/markdown-test.js.es6 | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/dialects/dialect.js b/app/assets/javascripts/discourse/dialects/dialect.js index 1614c1c0f19..cfb7b67f00b 100644 --- a/app/assets/javascripts/discourse/dialects/dialect.js +++ b/app/assets/javascripts/discourse/dialects/dialect.js @@ -135,7 +135,7 @@ function invalidBoundary(args, prev) { var last = prev[prev.length - 1]; if (typeof last !== "string") { return false; } - if (args.wordBoundary && (last.match(/(\w|\/)$/))) { return true; } + if (args.wordBoundary && (!last.match(/\W$/))) { return true; } if (args.spaceBoundary && (!last.match(/\s$/))) { return true; } if (args.spaceOrTagBoundary && (!last.match(/(\s|\>)$/))) { return true; } } diff --git a/test/javascripts/lib/markdown-test.js.es6 b/test/javascripts/lib/markdown-test.js.es6 index 25c2a69014b..1e657eb28e9 100644 --- a/test/javascripts/lib/markdown-test.js.es6 +++ b/test/javascripts/lib/markdown-test.js.es6 @@ -276,6 +276,10 @@ test("Mentions", function() { "
  1. this is a list

  2. this is an @eviltrout mention

", "it mentions properly in a list."); + cooked("Hello @foo/@bar", + "

Hello @foo/@bar

", + "handles mentions separated by a slash."); + cookedOptions("@eviltrout", alwaysTrue, "

@eviltrout

", "it doesn't onebox mentions");