Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #3541. Adds detection for firefox iOS mobile reporter #3548

Merged
merged 4 commits into from
Mar 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ def get_variation(variation_key, variations_dict, defaults_dict):
'browser-android-components',
'browser-fenix',
'browser-focus-geckoview',
'browser-firefox-ios',
'browser-firefox-reality',
'type-fastclick',
'type-google',
Expand Down
16 changes: 16 additions & 0 deletions tests/unit/test_webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,21 @@ def setUp(self):
<!-- @public_url: http://test.example.org/issues/1 -->
"""

self.issue_body8 = """
<!-- @browser: Firefox iOS 31.0 -->
<!-- @ua_header: Mozilla/5.0 (iPhone; CPU OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) FxiOS/31.0 Mobile/15E148 Safari/605.1.15 -->
<!-- @reported_with: mobile-reporter -->
<!-- @extra_labels: browser-firefox-ios -->
<!-- @public_url: https://github.com/webcompat/web-bugs/issues/67156 -->


**URL**: https://example.com/

**Browser / Version**: Firefox iOS 31.0
**Operating System**: iOS 14.4
**Tested Another Browser**: Yes Safari
""" # noqa

self.issue_info1 = {
'action': 'foobar',
'state': 'open',
Expand Down Expand Up @@ -317,6 +332,7 @@ def test_get_issue_labels(self):
(self.issue_body5, ['browser-firefox-reality', 'engine-gecko',
'type-media']),
(self.issue_body6, ['browser-safari']),
(self.issue_body8, ['browser-firefox-ios', 'os-ios']),
]
for issue_body, expected in labels_tests:
actual = helpers.get_issue_labels(issue_body)
Expand Down
22 changes: 12 additions & 10 deletions webcompat/webhooks/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@
from webcompat.issues import moderation_template

BROWSERS = ['blackberry', 'brave', 'chrome', 'edge', 'firefox', 'iceweasel', 'ie', 'lynx', 'myie', 'opera', 'puffin', 'qq', 'safari', 'samsung', 'seamonkey', 'uc', 'vivaldi'] # noqa
MOZILLA_BROWSERS = ['browser-android-components',
'browser-fenix',
'browser-firefox',
'browser-firefox-mobile',
'browser-firefox-reality',
'browser-firefox-tablet',
'browser-focus-geckoview',
'browser-geckoview',
]
GECKO_BROWSERS = ['browser-android-components',
'browser-fenix',
'browser-firefox',
'browser-firefox-mobile',
'browser-firefox-reality',
'browser-firefox-tablet',
'browser-focus-geckoview',
'browser-geckoview', ]
IOS_BROWSERS = ['browser-firefox-ios', ]
PUBLIC_REPO = app.config['ISSUES_REPO_URI']
PRIVATE_REPO = app.config['PRIVATE_REPO_URI']

Expand Down Expand Up @@ -157,8 +157,10 @@ def get_issue_labels(issue_body):
labelslist.extend(extra_labels)
priority_label = extract_priority_label(issue_body)
labelslist.extend([browser_label, priority_label])
if any(label for label in labelslist if label in MOZILLA_BROWSERS):
if any(label for label in labelslist if label in GECKO_BROWSERS):
labelslist.append('engine-gecko')
if any(label for label in labelslist if label in IOS_BROWSERS):
labelslist.append('os-ios')
labelslist = [label for label in labelslist if label is not None]
return labelslist

Expand Down