summaryrefslogtreecommitdiffstats
path: root/modules/references
diff options
context:
space:
mode:
authora1012112796 <1012112796@qq.com>2020-12-21 23:39:28 +0800
committerGitHub <noreply@github.com>2020-12-21 16:39:28 +0100
commit34df4e5df558e7ec648efe083696687be6f8c8a8 (patch)
tree883e619552a901b4a7437e8574e7307b47c1ac1d /modules/references
parent1b1adab26cbe86d77ee0e9a35b18d4765b371e26 (diff)
downloadgitea-34df4e5df558e7ec648efe083696687be6f8c8a8.tar.gz
gitea-34df4e5df558e7ec648efe083696687be6f8c8a8.zip
Add mentionable teams to tributeValues and change team mention rules to gh's style (#13198)
* Add mentionable teams to tributeValues Signed-off-by: a1012112796 <1012112796@qq.com> * Apply suggestions from code review Co-authored-by: silverwind <me@silverwind.io> * Change team mention rules to gh's style * use org's avator as team avator in ui Signed-off-by: a1012112796 <1012112796@qq.com> * Update modules/markup/html.go * Update models/issue.go Co-authored-by: Lauris BH <lauris@nix.lv> * Update models/issue.go * fix a small nit and update test code Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: 6543 <6543@obermui.de>
Diffstat (limited to 'modules/references')
-rw-r--r--modules/references/references.go4
-rw-r--r--modules/references/references_test.go2
2 files changed, 4 insertions, 2 deletions
diff --git a/modules/references/references.go b/modules/references/references.go
index 6e0baefc6e..c243f25f5d 100644
--- a/modules/references/references.go
+++ b/modules/references/references.go
@@ -26,8 +26,8 @@ var (
// While fast, this is also incorrect and lead to false positives.
// TODO: fix invalid linking issue
- // mentionPattern matches all mentions in the form of "@user"
- mentionPattern = regexp.MustCompile(`(?:\s|^|\(|\[)(@[0-9a-zA-Z-_]+|@[0-9a-zA-Z-_][0-9a-zA-Z-_.]+[0-9a-zA-Z-_])(?:\s|[:,;.?!]\s|[:,;.?!]?$|\)|\])`)
+ // mentionPattern matches all mentions in the form of "@user" or "@org/team"
+ mentionPattern = regexp.MustCompile(`(?:\s|^|\(|\[)(@[0-9a-zA-Z-_]+|@[0-9a-zA-Z-_]+\/?[0-9a-zA-Z-_]+|@[0-9a-zA-Z-_][0-9a-zA-Z-_.]+\/?[0-9a-zA-Z-_.]+[0-9a-zA-Z-_])(?:\s|[:,;.?!]\s|[:,;.?!]?$|\)|\])`)
// issueNumericPattern matches string that references to a numeric issue, e.g. #1287
issueNumericPattern = regexp.MustCompile(`(?:\s|^|\(|\[)([#!][0-9]+)(?:\s|$|\)|\]|[:;,.?!]\s|[:;,.?!]$)`)
// issueAlphanumericPattern matches string that references to an alphanumeric issue, e.g. ABC-1234
diff --git a/modules/references/references_test.go b/modules/references/references_test.go
index f51379e4c3..d4f080490d 100644
--- a/modules/references/references_test.go
+++ b/modules/references/references_test.go
@@ -325,6 +325,7 @@ func TestRegExp_mentionPattern(t *testing.T) {
{"@gitea.", "@gitea"},
{"@gitea,", "@gitea"},
{"@gitea;", "@gitea"},
+ {"@gitea/team1;", "@gitea/team1"},
}
falseTestCases := []string{
"@ 0",
@@ -340,6 +341,7 @@ func TestRegExp_mentionPattern(t *testing.T) {
"@gitea?this",
"@gitea,this",
"@gitea;this",
+ "@gitea/team1/more",
}
for _, testCase := range trueTestCases {