Commit 30e3fbfc authored by Doug Stull's avatar Doug Stull

Enable notification email to work for namespaces

- link needs to provide route via group path
parent b6602573
%p
- name_link = link_to @namespace.name, @namespace
- name_link = link_to @namespace.name, group_url(@namespace)
= html_escape(_('%{name_with_link} has run out of Shared Runner Pipeline minutes so no new jobs or pipelines in its projects will run.')) % { name_with_link: name_link.html_safe }
%p
= _('We recommend that you buy more Pipeline minutes to resume normal service.')
......
%p
- name_link = link_to @namespace.name, @namespace
- name_link = link_to @namespace.name, group_url(@namespace)
= html_escape(_('%{name_with_link} has %{percent} or less Shared Runner Pipeline minutes remaining. Once it runs out, no new jobs or pipelines in its projects will run.')) % { name_with_link: name_link.html_safe, percent: "#{@percentage_of_available_mins}%" }
%p
= _('We recommend that you buy more Pipeline minutes to avoid any interruption of service.')
......
---
title: Specify group url in notification email
merge_request: 33613
author:
type: fixed
......@@ -16,27 +16,43 @@ describe CiMinutesUsageMailer do
end
describe '#notify' do
it_behaves_like 'mail format' do
let(:subject_text) do
"Action required: There are no remaining Pipeline minutes for #{namespace.name}"
end
let(:subject_text) do
"Action required: There are no remaining Pipeline minutes for #{namespace.name}"
end
let(:body_text) { "has run out of Shared Runner Pipeline minutes" }
let(:body_text) { "has run out of Shared Runner Pipeline minutes" }
subject { described_class.notify(namespace, recipients) }
subject { described_class.notify(namespace, recipients) }
context 'when it is a group' do
it_behaves_like 'mail format'
end
context 'when it is a namespace' do
it_behaves_like 'mail format' do
let(:namespace) { create(:namespace) }
end
end
end
describe '#notify_limit' do
it_behaves_like 'mail format' do
let(:percent) { 30 }
let(:subject_text) do
"Action required: Less than #{percent}% of Pipeline minutes remain for #{namespace.name}"
end
let(:percent) { 30 }
let(:subject_text) do
"Action required: Less than #{percent}% of Pipeline minutes remain for #{namespace.name}"
end
let(:body_text) { "has #{percent}% or less Shared Runner Pipeline minutes" }
let(:body_text) { "has #{percent}% or less Shared Runner Pipeline minutes" }
subject { described_class.notify_limit(namespace, recipients, percent) }
subject { described_class.notify_limit(namespace, recipients, percent) }
context 'when it is a group' do
it_behaves_like 'mail format'
end
context 'when it is a namespace' do
it_behaves_like 'mail format' do
let(:namespace) { create(:namespace) }
end
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