Commit 7cfcabbe authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Fix places where we're showing the wrong plan

namespaces.plan_id is unused so we're actually showing incorrect
information on these pages / hooks
parent 004ecae8
...@@ -9,7 +9,7 @@ module EE ...@@ -9,7 +9,7 @@ module EE
override :group_member_data override :group_member_data
def group_member_data(model) def group_member_data(model)
super.tap do |data| super.tap do |data|
data[:group_plan] = model.group.plan&.name data[:group_plan] = model.group.gitlab_subscription&.plan_name
end end
end end
......
---
title: Fix group_plan in group member data for system hooks
merge_request: 29013
author:
type: fixed
...@@ -3,17 +3,27 @@ ...@@ -3,17 +3,27 @@
require 'spec_helper' require 'spec_helper'
describe EE::SystemHooksService do describe EE::SystemHooksService do
let(:group_member) { create(:group_member) }
let(:user) { create(:user) }
context 'when group member' do context 'when group member' do
let(:group) { create(:group) }
let(:group_member) { create(:group_member, group: group) }
context 'event data' do context 'event data' do
it { expect(event_data(group_member, :create)).to include(:event_name, :created_at, :updated_at, :group_name, :group_path, :group_plan, :group_id, :user_name, :user_username, :user_email, :user_id, :group_access) } it { expect(event_data(group_member, :create)).to include(:event_name, :created_at, :updated_at, :group_name, :group_path, :group_plan, :group_id, :user_name, :user_username, :user_email, :user_id, :group_access) }
it { expect(event_data(group_member, :destroy)).to include(:event_name, :created_at, :updated_at, :group_name, :group_path, :group_plan, :group_id, :user_name, :user_username, :user_email, :user_id, :group_access) } it { expect(event_data(group_member, :destroy)).to include(:event_name, :created_at, :updated_at, :group_name, :group_path, :group_plan, :group_id, :user_name, :user_username, :user_email, :user_id, :group_access) }
end end
context 'with a Gold plan' do
let(:group) { create(:group_with_plan, plan: :gold_plan) }
it 'returns correct group_plan' do
expect(event_data(group_member, :create)[:group_plan]).to eq('gold')
end
end
end end
context 'when user' do context 'when user' do
let_it_be(:user) { create(:user) }
context 'event data' do context 'event data' do
context 'for GitLab.com' do context 'for GitLab.com' do
before do before do
......
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