Detect intents where user linked to feature edit page. (#1895)

* Detect intents where user linked to feature edit page.

* corrected URL path
This commit is contained in:
Jason Robbins 2022-05-19 14:06:02 -07:00 коммит произвёл GitHub
Родитель 917c24b74d
Коммит c9c985f70e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 26 добавлений и 2 удалений

Просмотреть файл

@ -76,10 +76,12 @@ def detect_field(subject):
CHROMESTATUS_LINK_GENERATED_RE = re.compile(
r'entry on the Chrome Platform Status:?\s+'
r'[> ]*https?://(www\.)?chromestatus\.com/feature/(?P<id>\d+)', re.I)
r'[> ]*https?://(www\.)?chromestatus\.com/'
r'(feature|guide/edit)/(?P<id>\d+)', re.I)
CHROMESTATUS_LINK_ALTERNATE_RE = re.compile(
r'entry on the feature dashboard.*\s+'
r'[> ]*https?://(www\.)?chromestatus\.com/feature/(?P<id>\d+)', re.I)
r'[> ]*https?://(www\.)?chromestatus\.com/'
r'(feature|guide/edit)/(?P<id>\d+)', re.I)
NOT_LGTM_RE = re.compile(
r'\b(not|almost|need|want|missing) (a |an )?LGTM\b',
re.I)

Просмотреть файл

@ -128,6 +128,17 @@ class FunctionTest(testing_config.CustomTestCase):
5144822362931200,
detect_intent.detect_feature_id(body))
def test_detect_feature_id__generated_edit(self):
"""We can parse the feature ID from a link in the generated body."""
body = (
'blah blah blah\n'
'Link to entry on the Chrome Platform Status\n'
'https://www.chromestatus.com/guide/edit/5144822362931200\n'
'blah blah blah')
self.assertEqual(
5144822362931200,
detect_intent.detect_feature_id(body))
def test_detect_feature_id__generated_no_www(self):
"""We can parse the feature ID from a link in the generated body."""
body = (
@ -150,6 +161,17 @@ class FunctionTest(testing_config.CustomTestCase):
5144822362931200,
detect_intent.detect_feature_id(body))
def test_detect_feature_id__alternative_edit(self):
"""We can parse the feature ID from another common link."""
body = (
'blah blah blah\n'
'Entry on the feature dashboard\n'
'https://www.chromestatus.com/guide/edit/5144822362931200\n'
'blah blah blah')
self.assertEqual(
5144822362931200,
detect_intent.detect_feature_id(body))
def test_detect_feature_id__alternative_no_www(self):
"""We can parse the feature ID from another common link."""
body = (