Commit e9245077 authored by Krasimir Angelov's avatar Krasimir Angelov

Subscription expiration banner for top-level group owners only

instead of all owners of the current namespace.

Related to https://gitlab.com/gitlab-org/gitlab/-/issues/295308.
parent 50f16077
......@@ -51,7 +51,7 @@ module EE
::Gitlab::ExpiringSubscriptionMessage.new(
subscribable: decorated_subscription,
signed_in: signed_in?,
is_admin: can?(current_user, :owner_access, entity),
is_admin: can?(current_user, :owner_access, entity.root_ancestor),
namespace: current_namespace
).message
end
......
---
title: Show subscription expiration banner only for top-level group owners
merge_request: 54908
author:
type: changed
......@@ -122,7 +122,7 @@ RSpec.describe EE::SubscribableBannerHelper do
it 'calls Gitlab::ExpiringSubscriptionMessage and SubscriptionPresenter if is Gitlab.com?' do
allow(helper).to receive(:signed_in?).and_return(true)
allow(helper).to receive(:current_user).and_return(user)
allow(helper).to receive(:can?).with(user, :owner_access, entity).and_return(true)
allow(helper).to receive(:can?).with(user, :owner_access, root_namespace).and_return(true)
expect(SubscriptionPresenter).to receive(:new).with(gitlab_subscription).and_return(decorated_mock)
expect(::Gitlab::ExpiringSubscriptionMessage).to receive(:new).with(
......@@ -137,9 +137,11 @@ RSpec.describe EE::SubscribableBannerHelper do
end
end
let(:root_namespace) { create(:group_with_plan) }
let(:namespace) { create(:group, :nested, parent: root_namespace) }
context 'when a project is present' do
let(:entity) { create(:project, namespace: namespace) }
let(:namespace) { create(:namespace_with_plan) }
before do
assign(:project, entity)
......@@ -149,8 +151,7 @@ RSpec.describe EE::SubscribableBannerHelper do
end
context 'when a group is present' do
let(:entity) { create(:group_with_plan) }
let(:namespace) { entity }
let(:entity) { namespace }
before do
assign(:project, nil)
......
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