You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2021/08/24 15:38:58 UTC

[allura] branch master updated (db986f4 -> 2e90aef)

This is an automated email from the ASF dual-hosted git repository.

brondsem pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git.


    from db986f4  Fix SitemapEntry html attrs being skipped/clobbered in a few places
     new a38a82e  underscores in user's mentions parse correctly
     new 2e90aef  added test to validate parsing of usernames with underscores

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 Allura/allura/lib/markdown_extensions.py | 2 +-
 Allura/allura/tests/test_globals.py      | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

[allura] 01/02: underscores in user's mentions parse correctly

Posted by br...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

brondsem pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git

commit a38a82e41de46649193072c3dd0bb8609cd11f05
Author: Guillermo Cruz <gu...@slashdotmedia.com>
AuthorDate: Fri Aug 20 09:19:56 2021 -0600

    underscores in user's mentions parse correctly
---
 Allura/allura/lib/markdown_extensions.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Allura/allura/lib/markdown_extensions.py b/Allura/allura/lib/markdown_extensions.py
index c2050f7..ba36796 100644
--- a/Allura/allura/lib/markdown_extensions.py
+++ b/Allura/allura/lib/markdown_extensions.py
@@ -298,7 +298,7 @@ class EmojiInlinePattern(markdown.inlinepatterns.Pattern):
 
 class UserMentionExtension(markdown.Extension):
 
-    UM_RE = r'\B(@(?![0-9]+$)(?!-)[a-z0-9-]{2,14}[a-z0-9])'
+    UM_RE = r'\B(@(?![0-9]+$)(?!-)[a-z0-9_-]{2,14}[a-z0-9_])'
 
     def __init__(self, **kwargs):
         markdown.Extension.__init__(self)

[allura] 02/02: added test to validate parsing of usernames with underscores

Posted by br...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

brondsem pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git

commit 2e90aef3af5cca9788ed2ac923824cbf83a949a2
Author: Guillermo Cruz <gu...@slashdotmedia.com>
AuthorDate: Mon Aug 23 19:14:07 2021 -0600

    added test to validate parsing of usernames with underscores
---
 Allura/allura/tests/test_globals.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/Allura/allura/tests/test_globals.py b/Allura/allura/tests/test_globals.py
index 71a7dc1..52f1cf8 100644
--- a/Allura/allura/tests/test_globals.py
+++ b/Allura/allura/tests/test_globals.py
@@ -878,6 +878,15 @@ class TestUserMentions(unittest.TestCase):
         assert '<div class="codehilite">' in output
         assert ('href="%s"' % u1.url()) not in output
 
+    @patch('allura.lib.widgets.forms.NeighborhoodProjectShortNameValidator')
+    def test_markdown_user_mention_underscores(self, NeighborhoodProjectShortNameValidator):
+        username = 'r_808__'
+        NeighborhoodProjectShortNameValidator.to_python.return_value = username
+        u1 = M.User.register(dict(username=username), make_project=True)
+        ThreadLocalORMSession.flush_all()
+        output = g.markdown.convert(f'Hello.. @{username}, how are you?')
+        assert 'class="user-mention"' in output
+
 
 class TestHandlePaging(unittest.TestCase):