Merge branch 'master' of github.com:domify/registry

Conflicts:
	CHANGELOG.md
	app/mailers/domain_mailer.rb
	app/models/domain.rb
	app/views/layouts/registrant/application.haml
	config/application-example.yml
	config/locales/en.yml
	config/routes.rb
	spec/mailers/domain_mailer_spec.rb
This commit is contained in:
Martin Lensment 2015-05-14 18:01:06 +03:00
commit 412ececd9c
13 changed files with 82 additions and 25 deletions

View file

@ -0,0 +1,5 @@
class Registrant::WhoisController < RegistrantController
def index
authorize! :view, Registrant::Whois
end
end

View file

@ -1,18 +1,18 @@
class DomainMailer < ApplicationMailer
def registrant_updated(domain)
return if Rails.env.production? ? false : !TEST_EMAILS.include?(domain.registrant_email)
@domain = domain
return if Rails.env.production? ? false : !TEST_EMAILS.include?(@domain.registrant_email)
# turn on delivery on specific request only, thus rake tasks does not deliver anything
return if domain.deliver_emails != true
if domain.registrant_verification_token.blank?
return if @domain.deliver_emails != true
if @domain.registrant_verification_token.blank?
logger.warn "EMAIL DID NOT DELIVERED: registrant_verification_token is missing for #{@domain.name}"
return
return
end
@old_registrant = Registrant.find(domain.registrant_id_was)
@old_registrant = Registrant.find(@domain.registrant_id_was)
@verification_url = "#{ENV['registrant_url']}/etc/"
@domain = domain
mail(to: @old_registrant.email,
mail(to: @old_registrant.email,
subject: "#{I18n.t(:domain_registrant_update_subject, name: @domain.name)} [#{@domain.name}]")
end
end

View file

@ -13,6 +13,7 @@ class Ability
when 'ApiUser'
epp
registrar
registrant # refactor
end
can :show, :dashboard
@ -63,6 +64,10 @@ class Ability
can :manage, :deposit
end
def registrant
can :manage, Registrant::Whois
end
def user
can :show, :dashboard
end

View file

@ -60,9 +60,10 @@ class Domain < ActiveRecord::Base
def manage_statuses
return unless registrant_id_changed?
if registrant_verification_asked_at.present?
domain_statuses.build(value: DomainStatus::PENDING_UPDATE)
domain_statuses.build(value: DomainStatus::PENDING_UPDATE)
DomainMailer.registrant_updated(self).deliver_now
end
true
end
before_save :touch_always_version
@ -140,8 +141,8 @@ class Domain < ActiveRecord::Base
def included
includes(
:registrant,
:registrar,
:nameservers,
:registrar,
:nameservers,
:whois_record,
{ tech_contacts: :registrar },
{ admin_contacts: :registrar }
@ -253,7 +254,7 @@ class Domain < ActiveRecord::Base
end
# otherwise domain_statuses are in old state for domain object
domain_statuses.reload
domain_statuses.reload
end
def children_log

View file

@ -36,6 +36,9 @@
- active_class = %w(registrant/domains registrant/check registrant/renew registrant/tranfer registrant/keyrelays).include?(params[:controller]) ? 'active' :nil
%li{class: active_class}= link_to t(:domains), registrant_domains_path
- active_class = %w(registrant/whois).include?(params[:controller]) ? 'active' :nil
%li{class: active_class}= link_to t(:whois), registrant_whois_path
%ul.nav.navbar-nav.navbar-right
- if user_signed_in?
%li= link_to t(:log_out, user: current_user), '/registrant/logout'

View file

@ -0,0 +1,21 @@
= render 'shared/title', name: t(:whois)
- if ENV['restful_whois_url'].blank?
%p
Registrant configuration issue: missing restful_whois_url
- else
.row
.col-md-12{style: 'margin-bottom: -15px;'}
= form_tag registrant_whois_path, class: 'form-horizontal', method: :get do
.col-md-11
.form-group
= text_field_tag :domain_name, params[:domain_name], class: 'form-control', placeholder: t(:domain_name), autocomplete: 'off', autofocus: true
.col-md-1.text-right.text-center-xs
.form-group
%button.btn.btn-default
&nbsp;
%span.glyphicon.glyphicon-search
&nbsp;
%hr
- if @results
= @results