summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/gitblit
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/gitblit')
-rw-r--r--src/main/java/com/gitblit/Constants.java2
-rw-r--r--src/main/java/com/gitblit/models/TicketModel.java2
-rw-r--r--src/main/java/com/gitblit/tickets/TicketNotifier.java2
-rw-r--r--src/main/java/com/gitblit/utils/MarkdownUtils.java2
4 files changed, 4 insertions, 4 deletions
diff --git a/src/main/java/com/gitblit/Constants.java b/src/main/java/com/gitblit/Constants.java
index acfc2042..c7112835 100644
--- a/src/main/java/com/gitblit/Constants.java
+++ b/src/main/java/com/gitblit/Constants.java
@@ -67,7 +67,7 @@ public class Constants {
* This regular expression is used when searching for "mentions" in tickets
* (when someone writes @thisOtherUser)
*/
- public static final String REGEX_TICKET_MENTION = "\\s@([^\\s]+)";
+ public static final String REGEX_TICKET_MENTION = "\\B@(?<user>[^\\s]+)\\b";
public static final String ZIP_PATH = "/zip/";
diff --git a/src/main/java/com/gitblit/models/TicketModel.java b/src/main/java/com/gitblit/models/TicketModel.java
index 924400f5..65e29dc0 100644
--- a/src/main/java/com/gitblit/models/TicketModel.java
+++ b/src/main/java/com/gitblit/models/TicketModel.java
@@ -778,7 +778,7 @@ public class TicketModel implements Serializable, Comparable<TicketModel> {
Pattern mentions = Pattern.compile(Constants.REGEX_TICKET_MENTION);
Matcher m = mentions.matcher(text);
while (m.find()) {
- String username = m.group(1);
+ String username = m.group("user");
plusList(Field.mentions, username);
}
} catch (Exception e) {
diff --git a/src/main/java/com/gitblit/tickets/TicketNotifier.java b/src/main/java/com/gitblit/tickets/TicketNotifier.java
index 1d7e4f24..b913db25 100644
--- a/src/main/java/com/gitblit/tickets/TicketNotifier.java
+++ b/src/main/java/com/gitblit/tickets/TicketNotifier.java
@@ -576,7 +576,7 @@ public class TicketNotifier {
Pattern p = Pattern.compile(Constants.REGEX_TICKET_MENTION);
Matcher m = p.matcher(lastChange.comment.text);
while (m.find()) {
- String username = m.group();
+ String username = m.group("user");
ccs.add(username);
}
}
diff --git a/src/main/java/com/gitblit/utils/MarkdownUtils.java b/src/main/java/com/gitblit/utils/MarkdownUtils.java
index 794d54ab..8371b3c6 100644
--- a/src/main/java/com/gitblit/utils/MarkdownUtils.java
+++ b/src/main/java/com/gitblit/utils/MarkdownUtils.java
@@ -138,7 +138,7 @@ public class MarkdownUtils {
String canonicalUrl = settings.getString(Keys.web.canonicalUrl, "https://localhost:8443");
// emphasize and link mentions
- String mentionReplacement = String.format(" **[@$1](%1s/user/$1)**", canonicalUrl);
+ String mentionReplacement = String.format("**[@${user}](%1s/user/${user})**", canonicalUrl);
text = text.replaceAll(Constants.REGEX_TICKET_MENTION, mentionReplacement);
// link ticket refs