summaryrefslogtreecommitdiff
path: root/app/models/pages_domain.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/pages_domain.rb')
-rw-r--r--app/models/pages_domain.rb11
1 files changed, 7 insertions, 4 deletions
diff --git a/app/models/pages_domain.rb b/app/models/pages_domain.rb
index 486da2c6b45..da5e4012f05 100644
--- a/app/models/pages_domain.rb
+++ b/app/models/pages_domain.rb
@@ -2,6 +2,7 @@
class PagesDomain < ApplicationRecord
include Presentable
+ include FromUnion
VERIFICATION_KEY = 'gitlab-pages-verification-code'
VERIFICATION_THRESHOLD = 3.days.freeze
@@ -58,12 +59,14 @@ class PagesDomain < ApplicationRecord
end
scope :need_auto_ssl_renewal, -> do
- expiring = where(certificate_valid_not_after: nil).or(
- where(arel_table[:certificate_valid_not_after].lt(SSL_RENEWAL_THRESHOLD.from_now)))
+ enabled_and_not_failed = where(auto_ssl_enabled: true, auto_ssl_failed: false)
- user_provided_or_expiring = certificate_user_provided.or(expiring)
+ user_provided = enabled_and_not_failed.certificate_user_provided
+ certificate_not_valid = enabled_and_not_failed.where(certificate_valid_not_after: nil)
+ certificate_expiring = enabled_and_not_failed
+ .where(arel_table[:certificate_valid_not_after].lt(SSL_RENEWAL_THRESHOLD.from_now))
- where(auto_ssl_enabled: true).merge(user_provided_or_expiring)
+ from_union([user_provided, certificate_not_valid, certificate_expiring])
end
scope :for_removal, -> { where("remove_at < ?", Time.now) }