Commit b0f676c9 authored by Vladimir Shushlin's avatar Vladimir Shushlin

Add warning about failed LE certificates obtaining to domains list

+ view specs
parent b6b8ee4e
...@@ -30,3 +30,10 @@ ...@@ -30,3 +30,10 @@
= s_('GitLabPages|%{domain} is not verified. To learn how to verify ownership, visit your %{link_start}domain details%{link_end}.').html_safe % { domain: domain.domain, = s_('GitLabPages|%{domain} is not verified. To learn how to verify ownership, visit your %{link_start}domain details%{link_end}.').html_safe % { domain: domain.domain,
link_start: details_link_start, link_start: details_link_start,
link_end: details_link_end } link_end: details_link_end }
- elsif ::Gitlab::LetsEncrypt.enabled? && domain.auto_ssl_failed && Feature.enabled?(:pages_letsencrypt_errors, @project)
%li.list-group-item.bs-callout-warning
- details_link_start = "<a href='#{project_pages_domain_path(@project, domain)}'>".html_safe
- details_link_end = '</a>'.html_safe
= s_("GitLabPages|Something went wrong while obtaining Let's Encrypt certificate for %{domain}. To retry visit your %{link_start}domain details%{link_end}.").html_safe % { domain: domain.domain,
link_start: details_link_start,
link_end: details_link_end }
...@@ -9723,6 +9723,9 @@ msgstr "" ...@@ -9723,6 +9723,9 @@ msgstr ""
msgid "GitLabPages|Save" msgid "GitLabPages|Save"
msgstr "" msgstr ""
msgid "GitLabPages|Something went wrong while obtaining Let's Encrypt certificate for %{domain}. To retry visit your %{link_start}domain details%{link_end}."
msgstr ""
msgid "GitLabPages|Support for domains and certificates is disabled. Ask your system's administrator to enable it." msgid "GitLabPages|Support for domains and certificates is disabled. Ask your system's administrator to enable it."
msgstr "" msgstr ""
......
# frozen_string_literal: true
require 'spec_helper'
describe 'projects/pages/show' do
include LetsEncryptHelpers
let(:project) { create(:project, :repository) }
let(:user) { create(:user) }
let(:domain) { create(:pages_domain, project: project) }
let(:error_message) do
"Something went wrong while obtaining Let's Encrypt certificate for #{domain.domain}. "\
"To retry visit your domain details."
end
before do
allow(project).to receive(:pages_deployed?).and_return(true)
stub_pages_setting(external_https: true)
stub_lets_encrypt_settings
project.add_maintainer(user)
assign(:project, project)
allow(view).to receive(:current_user).and_return(user)
assign(:domains, [domain])
end
it "doesn't show auto ssl error warning" do
render
expect(rendered).not_to have_content(error_message)
end
context "when we failed to obtain Let's Encrypt's certificate" do
before do
domain.update!(auto_ssl_failed: true)
end
it 'shows auto ssl error warning' do
render
expect(rendered).to have_content(error_message)
end
it "doesn't show warning if lets_encrypt_error feature flag is disabled" do
stub_feature_flags(pages_letsencrypt_errors: false)
render
expect(rendered).not_to have_content(error_message)
end
it "doesn't show warning if Let's Encrypt integration is disabled" do
allow(::Gitlab::LetsEncrypt).to receive(:enabled?).and_return false
render
expect(rendered).not_to have_content(error_message)
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment