diff options
author | Harrison Healey <harrisonmhealey@gmail.com> | 2017-09-05 12:39:07 -0400 |
---|---|---|
committer | Saturnino Abril <saturnino.abril@gmail.com> | 2017-09-06 00:39:07 +0800 |
commit | 575864c917dbbe6b58d3e4534c3015327f2cb088 (patch) | |
tree | 547ecd46393b82961e4e5518d47273d8bb4ed2f6 /app/notification.go | |
parent | daed8ffbf6151f01866b9299574fdf6764c8b7bd (diff) | |
download | chat-575864c917dbbe6b58d3e4534c3015327f2cb088.tar.gz chat-575864c917dbbe6b58d3e4534c3015327f2cb088.tar.bz2 chat-575864c917dbbe6b58d3e4534c3015327f2cb088.zip |
PLT-7474 Stopped requiring confirmation for mentions in code blocks (#7375)
* PLT-7474 Stopped requiring confirmation for mentions in code blocks
* Stopped mentioning people from code blocks using ~~~
Diffstat (limited to 'app/notification.go')
-rw-r--r-- | app/notification.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/notification.go b/app/notification.go index b0a5d83ad..c86e1669f 100644 --- a/app/notification.go +++ b/app/notification.go @@ -839,14 +839,14 @@ func GetExplicitMentions(message string, keywords map[string][]string) (map[stri // Matches a line containing only ``` and a potential language definition, any number of lines not containing ```, // and then either a line containing only ``` or the end of the text -var codeBlockPattern = regexp.MustCompile("(?m)^[^\\S\n]*\\`\\`\\`.*$[\\s\\S]+?(^[^\\S\n]*\\`\\`\\`$|\\z)") +var codeBlockPattern = regexp.MustCompile("(?m)^[^\\S\n]*[\\`~]{3}.*$[\\s\\S]+?(^[^\\S\n]*[`~]{3}$|\\z)") // Matches a backquote, either some text or any number of non-empty lines, and then a final backquote var inlineCodePattern = regexp.MustCompile("(?m)\\`+(?:.+?|.*?\n(.*?\\S.*?\n)*.*?)\\`+") // Strips pre-formatted text and code blocks from a Markdown string by replacing them with whitespace func removeCodeFromMessage(message string) string { - if strings.Contains(message, "```") { + if strings.Contains(message, "```") || strings.Contains(message, "~~~") { message = codeBlockPattern.ReplaceAllString(message, "") } |