-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feature: add https to link filtering #22
Conversation
@@ -9,7 +9,7 @@ angular.module("thisissoon.core").filter("linkDisplay", [ | |||
"$filter", | |||
function($filter) { | |||
return function(input) { | |||
return input.replace("http://", "").replace("www.", ""); | |||
return input.replace("http://", "").replace("https://", "").replace("www.", ""); | |||
}; |
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.
@jamesjwarren would it not be better to use regex for this? something like: /[a-zA-Z]+:\/\//
would match any protocol and: /w{3}./
would match www.
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.
good idea
@@ -9,7 +9,7 @@ angular.module("thisissoon.core").filter("linkDisplay", [ | |||
"$filter", | |||
function($filter) { | |||
return function(input) { | |||
return input.replace("http://", "").replace("www.", ""); | |||
return input.replace(/.*?:\/\//g, "").replace(/w{3}./, "").replace(/\/.*/g, ""); | |||
}; |
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.
@jamesjwarren have you tested this? this is a classic case for unit testing
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.
There are tests for this here: https://github.com/thisissoon/thisissoon-frontend/blob/feature/link-filter/tests/unit/thisissoon-core/filters/linkDisplay.js but I could probably add a few more cases. I'll do that now.
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.
cool, good job 👍
Feature: add https to link filtering
No description provided.