Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorVladimir Shushlin <vshushlin@gitlab.com>2019-04-09 20:46:29 +0300
committerNick Thomas <nick@gitlab.com>2019-04-09 20:46:29 +0300
commitd69d29011cf9fe06e50a2c7d65b1ea88ea2d41d5 (patch)
treea794b2c4bfe9b00b552463928249b85957a5de05 /app
parent61ab1f7364b1ea44984a67bb6ea0f5a2b7a353c8 (diff)
Mark unverified pages domains for removal
Set pages_domain.remove_at when disabling it Add specs for marking pages domain for removal Notify user that domain is being removed Add documentation
Diffstat (limited to 'app')
-rw-r--r--app/services/verify_pages_domain_service.rb15
-rw-r--r--app/views/notify/_removal_notification.html.haml9
-rw-r--r--app/views/notify/pages_domain_disabled_email.html.haml4
-rw-r--r--app/views/notify/pages_domain_verification_failed_email.html.haml4
4 files changed, 20 insertions, 12 deletions
diff --git a/app/services/verify_pages_domain_service.rb b/app/services/verify_pages_domain_service.rb
index 07f7391f877..b53c3145caf 100644
--- a/app/services/verify_pages_domain_service.rb
+++ b/app/services/verify_pages_domain_service.rb
@@ -8,6 +8,7 @@ class VerifyPagesDomainService < BaseService
# How long verification lasts for
VERIFICATION_PERIOD = 7.days
+ REMOVAL_DELAY = 1.week.freeze
attr_reader :domain
@@ -36,7 +37,7 @@ class VerifyPagesDomainService < BaseService
# Prevent any pre-existing grace period from being truncated
reverify = [domain.enabled_until, VERIFICATION_PERIOD.from_now].compact.max
- domain.assign_attributes(verified_at: Time.now, enabled_until: reverify)
+ domain.assign_attributes(verified_at: Time.now, enabled_until: reverify, remove_at: nil)
domain.save!(validate: false)
if was_disabled
@@ -49,18 +50,20 @@ class VerifyPagesDomainService < BaseService
end
def unverify_domain!
- if domain.verified?
- domain.assign_attributes(verified_at: nil)
- domain.save!(validate: false)
+ was_verified = domain.verified?
- notify(:verification_failed)
- end
+ domain.assign_attributes(verified_at: nil)
+ domain.remove_at ||= REMOVAL_DELAY.from_now unless domain.enabled?
+ domain.save!(validate: false)
+
+ notify(:verification_failed) if was_verified
error("Couldn't verify #{domain.domain}")
end
def disable_domain!
domain.assign_attributes(verified_at: nil, enabled_until: nil)
+ domain.remove_at ||= REMOVAL_DELAY.from_now
domain.save!(validate: false)
notify(:disabled)
diff --git a/app/views/notify/_removal_notification.html.haml b/app/views/notify/_removal_notification.html.haml
new file mode 100644
index 00000000000..590e0d569aa
--- /dev/null
+++ b/app/views/notify/_removal_notification.html.haml
@@ -0,0 +1,9 @@
+- if @domain.remove_at
+ %p
+ Unless you verify your domain by
+ %strong= @domain.remove_at.strftime('%F %T,')
+ it will be removed from your GitLab project.
+- else
+ %p
+ If you no longer wish to use this domain with GitLab Pages, please remove it
+ from your GitLab project and delete any related DNS records.
diff --git a/app/views/notify/pages_domain_disabled_email.html.haml b/app/views/notify/pages_domain_disabled_email.html.haml
index 34ce4238a12..224b79bfde8 100644
--- a/app/views/notify/pages_domain_disabled_email.html.haml
+++ b/app/views/notify/pages_domain_disabled_email.html.haml
@@ -10,6 +10,4 @@
If this domain has been disabled in error, please follow
= link_to 'these instructions', help_page_url('user/project/pages/getting_started_part_three.md', anchor: 'dns-txt-record')
to verify and re-enable your domain.
-%p
- If you no longer wish to use this domain with GitLab Pages, please remove it
- from your GitLab project and delete any related DNS records.
+= render 'removal_notification'
diff --git a/app/views/notify/pages_domain_verification_failed_email.html.haml b/app/views/notify/pages_domain_verification_failed_email.html.haml
index 0bb0eb09fd5..03b298f8e7c 100644
--- a/app/views/notify/pages_domain_verification_failed_email.html.haml
+++ b/app/views/notify/pages_domain_verification_failed_email.html.haml
@@ -12,6 +12,4 @@
Please visit
= link_to 'these instructions', help_page_url('user/project/pages/getting_started_part_three.md', anchor: 'dns-txt-record')
for more information about custom domain verification.
-%p
- If you no longer wish to use this domain with GitLab Pages, please remove it
- from your GitLab project and delete any related DNS records.
+= render 'removal_notification'