Skip to content

Commit

Permalink
MBS-11694: Cleanup /intent/user Twitter URLs
Browse files Browse the repository at this point in the history
These seem to just give the visitor a popup to follow
the profile, seem otherwise trivial to clean up to the profile itself.
  • Loading branch information
reosarevok committed May 27, 2022
1 parent b62688c commit 71662e2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions root/static/scripts/edit/URLCleanup.js
Expand Up @@ -4464,6 +4464,10 @@ const CLEANUPS: CleanupEntries = {
/^(?:https?:\/\/)?(?:(?:www|mobile)\.)?twitter\.com(?:\/#!)?\//,
'https://twitter.com/',
);
url = url.replace(
/^(https:\/\/twitter\.com)\/intent\/user\/?\?screen_name=([^\/?#]+)/,
'$1/$2',
);
url = url.replace(
/^(https:\/\/twitter\.com)\/@?([^\/?#]+(?:\/status\/\d+)?)(?:[\/?#].*)?$/,
'$1/$2',
Expand Down
12 changes: 12 additions & 0 deletions root/static/scripts/tests/Control/URLCleanup.js
Expand Up @@ -4650,6 +4650,18 @@ limited_link_type_combinations: [
expected_relationship_type: 'socialnetwork',
expected_clean_url: 'https://twitter.com/cirrhaniva',
},
{
input_url: 'https://mobile.twitter.com/intent/user?screen_name=emily_doolittle',
input_entity_type: 'artist',
expected_relationship_type: 'socialnetwork',
expected_clean_url: 'https://twitter.com/emily_doolittle',
},
{
input_url: 'https://mobile.twitter.com/intent/user/?screen_name=emily_doolittle',
input_entity_type: 'artist',
expected_relationship_type: 'socialnetwork',
expected_clean_url: 'https://twitter.com/emily_doolittle',
},
{
input_url: 'https://twitter.com/@UNIVERSAL_D',
input_entity_type: 'label',
Expand Down

0 comments on commit 71662e2

Please sign in to comment.