-
Notifications
You must be signed in to change notification settings - Fork 5
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
GDPR preparations for RESTful WHOIS #41
Conversation
* Add missing integration tests * Use Jbuilder for generating JSON * Refactor WhoisRecord model
* Remove gemset collision with registry * Remove Recaptcha api version, as only version 2 is supported
* Add tests that handle 404 requests * Add tests that handle POST HTTP verb
5b36ba1
to
8e6a4bb
Compare
8e6a4bb
to
bcba344
Compare
@@ -1 +1 @@ | |||
registry | |||
rest-whois |
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.
How do we use this file?
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.
According to @teadur it has no bearing on production since servers are physically and logically separated.
However, locally it produces an undesired behaviour inside rvm
/rbenv
: both registry
and and rest-whois
used the same gemset, which for example contained 2 different versions of rails (4.2.10
and 4.2.7
). It also allowed gems to "sneak" from one environment to another:
def full_body | ||
@disclosed = (json['disclosed'] || []).dup | ||
return body.to_s if @disclosed.empty? | ||
BLOCKED = 'Blocked'.freeze |
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.
Perhaps it's worth using private_constant
to hide them?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
<html lang="en"> | ||
<head> | ||
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/> |
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.
This seems unnecessary
<meta content="IE=edge" http-equiv="X-UA-Compatible"/> | ||
<meta content="width=device-width, initial-scale=1" name="viewport"/> | ||
<meta content="Full stack top-level domain (TLD) management." name="description"/> | ||
<meta content="Estonian Internet Foundation" name="author"/> |
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.
How about removing the entire section? I don't see any point of it.
<meta content="IE=edge" http-equiv="X-UA-Compatible"/>
<meta content="width=device-width, initial-scale=1" name="viewport"/>
<meta content="Full stack top-level domain (TLD) management." name="description"/>
<meta content="Estonian Internet Foundation" name="author"/>
@@ -0,0 +1,8 @@ | |||
<% display = (flash[:notice] || flash[:alert] || flash[:warning]) ? 'block' : 'none' %> |
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.
Any chance to make this view more readable? Currently I find it hard to read.
</pre> | ||
<% if @verified.blank? %> | ||
<div class="full_info_form" style="padding: 20px 0 0 24px"> | ||
<%= form_for @whois_record, url: "/v1/#{@whois_record.name}", method: :get do |f| %> |
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.
Don't see f
variable used. Wonder if we really need form_for
here.
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.
For all 3 comments above3: You'd have to ask Herbalizer, I converted it, since it worked, I didn't see any point in dwelling into the details of the rendered ERB.
<%= render partial: "whois", locals: { json: @whois_record.json } %> | ||
</pre> | ||
<% if @verified.blank? %> | ||
<div class="full_info_form" style="padding: 20px 0 0 24px"> |
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.
The convention is to use dashes instead of underscores for CSS entities.
|
||
@private_domain = whois_records(:privately_owned) | ||
@legal_domain = whois_records(:legally_owned) | ||
@discarded_domain = whois_records(:discarded) |
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.
Why WhoisRecord
is assigned to a discarded_domain
variable instead of whois_record
? One can assume that he or she deals with a domain, whereas it is actually WHOIS-record.
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.
Because whois_record_for_discarded_domain
feels too long.
|
||
def test_partial_name_for_private_person | ||
assert_equal('private_person', @private_domain.partial_name) | ||
assert_equal('private_person', @private_domain.partial_name(true)) |
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.
How about using keyword argument here? I need to dig in into that method's definition to find out what does that true
mean.
@@ -0,0 +1,57 @@ | |||
Domain: |
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 is a duplication between legal_person_for_authorized.json.jbuilder
and legal_person.json.jbuilder
. I see a clear pattern of undisclosed data ("Not Disclosed - Visit www.internet.ee for webbased WHOIS").
Perhaps we could unify those templates?
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 decided against it since you end up with an if block, something I find rather unreadable in templates. I'd rather live with the repetition.
if @verified
json.array!(whois_record.json['tech_contacts']) do |_contact|
json.name 'Not Disclosed'
json.email 'Not Disclosed'
json.changed 'Not Disclosed'
end
else
json.array!(whois_record.json['admin_contacts']) do |_contact|
json.name 'Not Disclosed - Visit www.internet.ee for webbased WHOIS'
json.email 'Not Disclosed - Visit www.internet.ee for webbased WHOIS'
json.changed 'Not Disclosed - Visit www.internet.ee for webbased WHOIS'
end
end
I prefer having multiple templates to one that covers multiple, hence the design where WhoisRecord
instance tells the controller which template to render, not the controller/template asking the WhoisRecord
about its properties.
c79bf2d
to
0091c57
Compare
@vohmar We have discussed above mentioned issues with @maciej-szlosarczyk so you're free to merge it once tested. And the sooner the better, since there are other upcoming changes. |
Fixes #37, #38 and #40.
Also: