Skip to content

Commit 71723e8

Browse files
Release 30 04 2025
Release 30 04 2025 Shared Plans
2 parents d004147 + b6df6f8 commit 71723e8

File tree

3 files changed

+56
-0
lines changed

3 files changed

+56
-0
lines changed

lib/travis/addons/plan/mailer/plan_mailer.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,15 @@ def end_trial_reminder(receivers, owner, params)
8484
mail(from: from, to: receivers, subject: subject, template_path: 'plan_mailer')
8585
end
8686

87+
def shared_plan_no_admin(receivers, owner, params)
88+
@receiver = params.fetch(:receiver)[:login]
89+
@donor = params.fetch(:donor)
90+
@recipients = params.fetch(:recipients)
91+
@plan_share_url = plan_share_url(@donor)
92+
subject = 'Review Your Plan Sharing Settings'
93+
mail(from: from, to: @recipients, subject: subject, template_path: 'plan_mailer')
94+
end
95+
8796
private
8897

8998
def from
@@ -132,6 +141,11 @@ def filter_receivers(receivers)
132141
receivers = receivers.flatten.uniq.compact
133142
receivers.reject { |email| email.include?("[") || email.include?(" ") || email.ends_with?(".home") }
134143
end
144+
145+
def plan_share_url(owner)
146+
owner[:owner_type] == 'User' ? "https://#{config.host}/account/plan/share" :
147+
"https://#{config.host}/organizations/#{owner[:login]}/plan/share"
148+
end
135149
end
136150
end
137151
end
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<tr>
2+
<td id="plan-message-section" align="center" valign="top" style="padding-bottom: 40px;">
3+
<h1 id="plan-message-header">
4+
Hi!
5+
</h1>
6+
<p id="plan-message" style="margin: 0px; font-size: 18px; margin-bottom: 10px;">
7+
We wanted to inform you that your last admin user has lost access to the <%= @receiver %> Travis CI account associated with your shared plan. As a result, they no longer have visibility into the receiver account.
8+
</p>
9+
<p id="plan-message" style="margin: 0px; font-size: 18px; margin-bottom: 10px;">
10+
This change may be intended, but if not, we recommend reviewing your plan-sharing settings to ensure everything is configured as expected.
11+
</p>
12+
13+
<p id="plan-message" style="margin: 0px; font-size: 18px; margin-bottom: 10px;">
14+
You can manage your sharing settings here: <a href="<%= @plan_share_url %>">Plan Share settings</a>
15+
</p>
16+
</td>
17+
</tr>

spec/addons/plan/mailer/plan_mailer_spec.rb

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,29 @@
5151
expect(mail.body).to match(Travis.config.enterprise_platform.host)
5252
end
5353
end
54+
55+
describe '#plan_share_no_admin' do
56+
57+
subject(:mail) { described_class.shared_plan_no_admin(recipients, owner, params) }
58+
59+
let(:receiver) do
60+
{
61+
login: 'tester',
62+
name: 'Testing Tester',
63+
owner_type: 'Organization'
64+
}
65+
end
66+
67+
let(:params) do
68+
{ receiver: receiver,
69+
donor: owner,
70+
recipients: ['admin1@owner.org', 'admin2@owner.org']
71+
}
72+
end
73+
74+
it 'contains the right data' do
75+
expect(mail.to).to eq(params[:recipients])
76+
expect(mail.body).to match('tester Travis CI account associated with your shared plan')
77+
end
78+
end
5479
end

0 commit comments

Comments
 (0)