-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Reader Manage Following: present a follow button if user appears to have entered a URL #13715
Conversation
Todo:
|
@@ -0,0 +1,43 @@ | |||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should squint at this file a bit and try to merge it with /lib/url/index.js
isUrl is brand new, but the others looks like they may exist with a different name
@blowery merged in a selector that should be able to grab that data! |
Todo in followup PRs:
|
…ng and removing URL protocol
@@ -285,3 +286,30 @@ describe( 'urlToSlug()', () => { | |||
expect( urlWithoutHttp ).to.equal( 'example.com::example::test123' ); | |||
} ); | |||
} ); | |||
|
|||
describe( 'resemblesUrl()', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
beautiful.
this entire commit is beautiful
|
||
// Make sure the query has a protocol - hostname ends up blank otherwise | ||
if ( ! parsedUrl.protocol ) { | ||
parsedUrl = url.parse( 'http://' + query ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we may also want to verify that it's a protocol we support or can switch to. For example, gopher://
would be invalid, but we could switch feed://
to http://
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a cool idea. I won't do it in this particular spot (resemblesUrl
) because it might be reused by other things, but worth us keeping in mind.
client/lib/url/test/index.js
Outdated
} ); | ||
|
||
it( 'should return false if the string is not a URL', () => { | ||
const source = 'exampledotcom'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
other test cases:
..com
. . .com
...com
.
<unicode non breaking spaces>.com
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some extras in e1aa849 👍
there something funky going on with the generated url. Sample action dispatched:
|
Ah - |
This happens in
|
giving this another test and if all looks good I'll 🚢 . |
testing checked out. |
@@ -94,7 +97,7 @@ class FollowingManage extends Component { | |||
this.resizeSearchBox(); | |||
|
|||
// this is a total hack. In React-Virtualized you need to tell a WindowScroller when the things | |||
// above it has moved with a call to updatePosision(). Our issue is we don't have a good moment | |||
// above it has moved with a call to updatePosition(). Our issue is we don't have a good moment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
didn't notice this before. thanks for the typo fix :)
As outlined in #12950, present a follow button rather than search results if the user has entered a URL in the search input on Manage Following: