Skip to content

Commit

Permalink
Merge pull request #1420 from glogiotatidis/issue-1419
Browse files Browse the repository at this point in the history
[Fix #1419] Set entrypoint_* only to about:logins
  • Loading branch information
glogiotatidis committed Jul 27, 2020
2 parents 70ad933 + 3d7b1de commit 8dee499
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
15 changes: 11 additions & 4 deletions snippets/base/tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def test_multiple_links_with_metrics(self):
'special_account': 'With <a href="special:accounts">special accounts link</a>.',
'special_appMenu': 'and another <a href="special:menu:appMenu">special menu link</a>',
'special_about': 'and an <a href="special:about:about">about:about</a> link',
'special_about_logins': 'and another <a href="special:about:logins">about:logins</a>',
'special_preferences': 'and finally <a href="special:preferences">preferences</a>.',
'nolinks': 'And finally one with no links.',
}
Expand All @@ -65,7 +66,8 @@ def test_multiple_links_with_metrics(self):
'special_account': 'With <link5>special accounts link</link5>.',
'special_appMenu': 'and another <link6>special menu link</link6>.',
'special_about': 'and an <link7>about:about</link7> link',
'special_preferences': 'and finally <link8>preferences</link8>.',
'special_about_logins': 'and an <link8>about:logins</link8> link',
'special_preferences': 'and finally <link9>preferences</link9>.',
'nolinks': 'And finally one with no links.',
'links': {
'link0': {
Expand Down Expand Up @@ -96,10 +98,14 @@ def test_multiple_links_with_metrics(self):
'link7': {
'action': 'OPEN_ABOUT_PAGE',
'args': 'about',
},
'link8': {
'action': 'OPEN_ABOUT_PAGE',
'args': 'logins',
'entrypoint_name': 'entryPoint',
'entrypoint_value': 'snippet',
},
'link8': {
'link9': {
'action': 'OPEN_PREFERENCES_PAGE',
'entrypoint_value': 'snippet',
},
Expand All @@ -108,7 +114,7 @@ def test_multiple_links_with_metrics(self):
generated_data = fluent_link_extractor(
data,
['text', 'title', 'special_account', 'special_appMenu',
'special_about', 'special_preferences', 'nolinks']
'special_about', 'special_about_logins', 'special_preferences', 'nolinks']
)

self.assertEqual(final_data['text'], generated_data['text'])
Expand All @@ -133,7 +139,8 @@ def test_base(self):
inputs = [
('https://example.com', (None, None, None, None)),
('special:menu:foo', ('OPEN_APPLICATIONS_MENU', 'foo', None, None)),
('special:about:login', ('OPEN_ABOUT_PAGE', 'login', 'entryPoint', 'snippet')),
('special:about:about', ('OPEN_ABOUT_PAGE', 'about', None, None)),
('special:about:logins', ('OPEN_ABOUT_PAGE', 'logins', 'entryPoint', 'snippet')),
('special:highlight:foo', ('HIGHLIGHT_FEATURE', 'foo', None, None)),
('special:preferences', ('OPEN_PREFERENCES_PAGE', None, None, 'snippet')),
('special:accounts', ('SHOW_FIREFOX_ACCOUNTS', None, None, None)),
Expand Down
5 changes: 3 additions & 2 deletions snippets/base/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,9 @@ def convert_special_link(url):
elif url.startswith('special:about:'):
action = 'OPEN_ABOUT_PAGE'
args = url.rsplit(':', 1)[1]
entrypoint_name = 'entryPoint'
entrypoint_value = 'snippet'
if url.startswith('special:about:logins'):
entrypoint_name = 'entryPoint'
entrypoint_value = 'snippet'
elif url.startswith('special:highlight:'):
action = 'HIGHLIGHT_FEATURE'
args = url.rsplit(':', 1)[1]
Expand Down

0 comments on commit 8dee499

Please sign in to comment.