Commit ef9ce775 authored by Jan Provaznik's avatar Jan Provaznik

Merge branch 'ag/remove_redundant_method' into 'master'

Simplify SubscriptionsHelper API

See merge request gitlab-org/gitlab!71703
parents 9a902cb5 2219ee57
...@@ -17,15 +17,10 @@ module SubscriptionsHelper ...@@ -17,15 +17,10 @@ module SubscriptionsHelper
end end
def buy_addon_data(group, anchor, purchased_product) def buy_addon_data(group, anchor, purchased_product)
{
redirect_after_success: group_usage_quotas_path(group, anchor: anchor, purchased_product: purchased_product)
}.merge(addon_data(group))
end
def addon_data(group)
{ {
group_data: [present_group(group)].to_json, group_data: [present_group(group)].to_json,
namespace_id: params[:selected_group], namespace_id: params[:selected_group],
redirect_after_success: group_usage_quotas_path(group, anchor: anchor, purchased_product: purchased_product),
source: params[:source] source: params[:source]
} }
end end
......
- page_title _('Buy CI Minutes') - page_title _('Buy CI Minutes')
#js-buy-minutes{ data: buy_addon_data(@group, 'pipelines-quota-tab', _('CI minutes')) } #js-buy-minutes{ data: buy_addon_data(@group, 'pipelines-quota-tab', _('Checkout|CI minutes')) }
...@@ -133,23 +133,6 @@ RSpec.describe SubscriptionsHelper do ...@@ -133,23 +133,6 @@ RSpec.describe SubscriptionsHelper do
end end
end end
describe '#addon_data' do
subject(:addon_data) { helper.addon_data(group) }
let_it_be(:user) { create(:user, name: 'First Last') }
let_it_be(:group) { create(:group, name: 'My Namespace') }
before do
allow(helper).to receive(:current_user).and_return(user)
allow(helper).to receive(:params).and_return({ selected_group: group.id.to_s, source: 'some_source' })
group.add_owner(user)
end
it { is_expected.to include(namespace_id: group.id.to_s) }
it { is_expected.to include(source: 'some_source') }
it { is_expected.to include(group_data: %Q{[{"id":#{group.id},"name":"My Namespace","users":1,"guests":0}]}) }
end
describe '#buy_addon_data' do describe '#buy_addon_data' do
subject(:buy_addon_data) { helper.buy_addon_data(group, anchor, purchased_product) } subject(:buy_addon_data) { helper.buy_addon_data(group, anchor, purchased_product) }
......
...@@ -5965,9 +5965,6 @@ msgstr "" ...@@ -5965,9 +5965,6 @@ msgstr ""
msgid "CI configuration validated, including all configuration added with the %{codeStart}includes%{codeEnd} keyword. %{link}" msgid "CI configuration validated, including all configuration added with the %{codeStart}includes%{codeEnd} keyword. %{link}"
msgstr "" msgstr ""
msgid "CI minutes"
msgstr ""
msgid "CI settings" msgid "CI settings"
msgstr "" msgstr ""
...@@ -6637,6 +6634,9 @@ msgstr "" ...@@ -6637,6 +6634,9 @@ msgstr ""
msgid "Checkout|CI minute packs are only used after you've used your subscription's monthly quota. The additional minutes will roll over month to month and are valid for one year." msgid "Checkout|CI minute packs are only used after you've used your subscription's monthly quota. The additional minutes will roll over month to month and are valid for one year."
msgstr "" msgstr ""
msgid "Checkout|CI minutes"
msgstr ""
msgid "Checkout|Checkout" msgid "Checkout|Checkout"
msgstr "" msgstr ""
......
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